I have a collection of objects. Objects are instance of the same class. I need to verify that the variable reviewed_object_name occurs in the object_name field of any object in the collection.
When I have a simple collection the solution is obvious:
reviewed_object_name = "Hotel Roma"
reviewed_objects_collection = ["Hotel Roma", "Hotel Berlin", "Hotel Paris", "Hotel Madrit"]
reviewed_object_name in reviewed_objects_collection
expression returns True
The problem arises when I have a collection of objects
I tried to do this using lambda:
some_function (reviewed_objects_collection, key = lambda review_object_info: review_object_info.name)
What function would be able to give me this information?
any()with a genex.