initializing mutable class attributes
aleaxit at yahoo.com
Thu Sep 2 09:13:55 CEST 2004
Dan Perl <dperl at rogers.com> 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 to do
> that. Thanks.
If you define several parent-less classes in a module, it may be simpler
to place at the module's start the assignment statement:
__metaclass__ = type
This is equivalent to explicitly specifying object as the base class of
any otherwise parent-less class.
More information about the Python-list