Why object will be passed in certain cases.What is the need passing the object as the class argument.I know that it would be useful at the time of decorators but other than that any other need for this
class MyClass(object):
def __init__(self):
self.numbers = [1,2,3,4,54]
def __contains__(self, key):
return key in self.numbers
The second code also works without object argument
class MyClass:
def __init__(self):
self.numbers = [1,2,3,4,54]
def __contains__(self, key):
return key in self.numbers