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

bruno at modulix onurb at xiludom.gro
Tue Apr 11 08:47:27 EDT 2006


looping wrote:
> Peter Hansen wrote:
> 
>>Georg Brandl wrote:
>>
>>>class C():
>>>
>>>is meant to be synonymous with
>>>
>>>class C:
>>>
>>>and therefore cannot create a new-style class.
>>
>>I think "looping" understands that, but is basically asking why anyone
>>is bothering with a change that involves a part of the language that is
>>effectively deprecated.  In other words, class(): never used to be
>>valid, so why make it valid now?
>>
>>-Peter
> 
> 
> Exact.
> But I think that if we make "class C():" a synonym of "class
> C(object):", it will save lot of keystrokes ;-)

Since the class statement without superclass actually creates an
old-style class,  I'd expect the "class MyClass():" variant to behave
the same. Sacrifying readability and expliciteness just to save half a
dozen keystrokes is not pythonic IMHO.


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list