initializing mutable class attributes
dperl at rogers.com
Wed Sep 1 18:24:32 CEST 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:
d = derived()
The call to test.__init__(self) raises an AttributeError exception.
"Diez B. Roggisch" <deetsNOSPAM at web.de> wrote in message
news:ch4skh$223$04$1 at news.t-online.com...
> Dan Perl wrote:
> > My mistake. You're right, and it's all because of the inheritance from
> > 'object', which probably defines a default, empty, __init__. I haven't
> > made a habit of subclassing from 'object' yet and I see that I'll have
> > do
> > that. Thanks.
> You can safely remove the object as ancestor - it works with old-style
> classes, too.
> Diez B. Roggisch
More information about the Python-list