I
iMath
what is the difference between commenting and uncommenting the __init__ method in this class?
class CounterList(list):
counter = 0
## def __init__(self, *args):
## super(CounterList, self).__init__(*args)
def __getitem__(self, index):
self.__class__.counter += 1
return super(CounterList, self).__getitem__(index)
class CounterList(list):
counter = 0
## def __init__(self, *args):
## super(CounterList, self).__init__(*args)
def __getitem__(self, index):
self.__class__.counter += 1
return super(CounterList, self).__getitem__(index)