initializing mutable class attributes

Dan Perl dperl at
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:
    class test:

    class derived(test):
        def __init__(self):

    d = derived()

The call to test.__init__(self) raises an AttributeError exception.


"Diez B. Roggisch" <deetsNOSPAM at> wrote in message
news:ch4skh$223$04$1 at
> 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.
> -- 
> Regards,
> Diez B. Roggisch

More information about the Python-list mailing list