[Python-Dev] RE: Hot-To Guide for Descriptors - Nits! :-)

Jeremy Hylton jeremy at alum.mit.edu
Wed Jan 21 21:05:02 EST 2004


On Wed, 2004-01-21 at 20:24, François Pinard wrote:
> If there is no base class, then "if there's a global variable named
> __metaclass__, it is used."  So my guess would be that adding a mere
> 
>    __metaclass__ = type
> 
> in global scope for a module would make all classes be "new-style",
> without the need to subclass them from object explicitly.

Unless you define a class that inherits from a base class defined in
another module.  __metaclass__ does not apply when there are base
classes.  I prefer to inherit from object, because it is more explicit,
and avoids possible confusion when some classes have classic bases.

Jeremy





More information about the Python-Dev mailing list