initializing mutable class attributes

Diez B. Roggisch deetsNOSPAM at web.de
Wed Sep 1 13:33:23 EDT 2004


> I'm not sure what you mean by removing the object as ancestor, but here is
> a modified code similar to Jorge's and it doesn't work:
>     class test:
>         pass
> 
>     class derived(test):
>         def __init__(self):
>                 test.__init__(self)
> 
>     d = derived()
> 
> The call to test.__init__(self) raises an AttributeError exception.

I'm sorry, you're right - I meant to modify the example the way you did, to
check if it works or not. But for some reason I just made it run (which was
more work than expected due to embedded unicode spaces) and then forgot to
actually do what I wanted - remove the (object).

And then it doesn't work, as you correctly observed. Sorry for me beeing
confused.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list