In something like this
class Obj:
def __init__(self, x, y):
self.x = x
self.y = y
li = [Obj(0, 0), Obj(0, 1), Obj(2, 3)]
print(Obj(2,3) in li)
I have a False output because even if x and y are the same it counts the object as a different instance. I can remedy using a loop inside the list and checking
if(2==o.x and 3==o.y):
return True
Is there some cleaner way to get this without using a loop ?