I have a Python list of some complex objects, and a target object which I wish to check of its occurrence in the list by value.
In other words, I need to find if any of the objects in the list, has the same attributes with the same values as the target object.
I tried:
if node in nodes: But this compares the references of the objects not the values.
I know I can do some nested loops to check every single attribute, but I am looking for a smarter way, if any.
Nodeclass (e.g. add a method)?__eq__defined on these classes you're comparing to?