Inheriting from object

Steven Bethard steven.bethard at
Thu Jun 30 02:02:06 CEST 2005

Fuzzyman wrote:
> Surely when they are removed :
> class foo:
>     pass
> won't become invalid syntax, it will just automatically inherit from
> object ?

Well, Guido views this particular syntax as an "oopsie"[1].  It should 
actually look like:

     class C():

Guido also suggests that the explicit:

     class C(object):

is "much preferred"[2] over:

     __metaclass__ = type

     class C:

when creating new-style classes.  It's not exactly clear where Guido 
comes down on your particular issue, but if I had to guess, I would 
guess that he prefers the explicit reference to "object".



More information about the Python-list mailing list