initializing mutable class attributes
Alex Martelli
aleaxit at yahoo.com
Thu Sep 2 03:13:55 EDT 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.
Alex
More information about the Python-list
mailing list