On Sep 21, 7:15 pm, Ricardo Aráoz <[EMAIL PROTECTED]> wrote:
> Hi, I know I'm being dumb but, why does it not work?
>
> >>> class MyList(list):
>
> ... def __init__(self):
> ... self.calls = 0
> ... def __getattr__(self, name):
> ... self.calls += 1
> ... return list
Hi, I know I'm being dumb but, why does it not work?
>>> class MyList(list):
... def __init__(self):
... self.calls = 0
... def __getattr__(self, name):
... self.calls += 1
... return list.__getattribute__(self, name)
>>> a = MyList()
>>> a
[]
>>> a.append(1)
>>> a