"New" style classes

Pettersen, Bjorn S BjornPettersen at fairisaac.com
Wed Sep 17 21:48:27 CEST 2003


> From: Tobiah [mailto:toby at rcsreg.com] 
> 
> I gather that a "new style" class inherits from object.
> 
> Is this to be considered the way to make all classes
> from now on?  If not, when will I know to inherit from
> object?  I noticed that it clutters up pydoc output.

If you don't know if you need to inherit from object, it's probably not
going to make a difference. (There are semantic differences for e.g.
metaclasses, descriptors and other things that are rarely used ;-) The
only real issue I can remember is that you'll need to use new style
classes if you want properties.

Eventually, there will only be "new style" classes, but by then
inheriting from object might be implicit. In other words... hakuna
matata.

-- bjorn





More information about the Python-list mailing list