Here is part of my code:
some_item = target_item
first_item = my_list
<models.adb.ADB object at 0x7f1ec7654b50>
<models.seb.SEB object at 0x7f1ec7654b90>
It depends on the comparison implemented for
SEB, probably by implementing the
__eq__ operator for this classes.
When python will look for the instance of
some_item on the list, he will use this operator to determine if the
i-th element on the list is this element, sweeping for every
Therefore, if the implementation is like
class Parent: def __init__(self): self.x = 0 def __eq__(parentObj): return self.x == parentObj.x class ADB (Parent): def __init__(self): super.__init__() class SEB (Parent): def __init__(self): super.__init__()
it would result in
ADB() == SEB(), therefore, causing the objects to both "match" the first list's element when being compared to it, but being different objects at the same time.
Note that same can go for this as well, used inheritance for simplification of the example.
class ADB (Parent): def __init__(self): self.x = 0 def __eq__(obj): return self.x == obj.x class SEB (Parent): def __init__(self): self.x = 0 def __eq__(obj): return self.x == obj.x