Why new Python 2.5 feature "class C()" return old-style class ?

Georg Brandl g.brandl-nospam at gmx.net
Tue Apr 11 07:09:54 EDT 2006


looping wrote:
> For Python developers around.
> 
>>From Python 2.5 doc:
> The list of base classes in a class definition can now be empty. As an
> example, this is now legal:
>   class C():
>       pass
> 
> nice but why this syntax return old-style class, same as "class C:",
> and not the new style "class C(object):" ?
> Old-style class are somewhat deprecated and could be almost always be
> replaced by new-style class, so this syntax could be a nice shortcut to
> create them.
> 
> Am I wrong or is there something that I've missed ?

class C():

is meant to be synonymous with

class C:

and therefore cannot create a new-style class.

Georg



More information about the Python-list mailing list