On 01/28/2013 09:09 PM, iMath wrote:
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)
If you don't call the super-class' __init__() method, then the list
won't take anyparameters. So the list will be empty,
--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list