How can I check if an object is in another object? So say I have the following defined:
class Container:
def __init__(self):
self.a = ['x','y','z']
and I want to be able to make the following work:
'x' in Container() # True
My attempt/guess was that there was some type of dunder method for in like so:
class Container:
def __init__(self):
self.a = ['x','y','z']
def __in__(self, item):
return item in self.a