why are people still using classic classes?

Aahz aahz at pythoncraft.com
Thu Jan 13 08:49:03 EST 2005


In article <R_udnQYX0Nxw53vcRVn-hw at powergate.ca>,
Peter Hansen  <peter at engcorp.com> wrote:
>
>Unfortunately, if we should follow the recent advice about always using
>"super()" in the __init__ method, it's hard to do what you suggest
>(though it sounds like good advice) without resorting to extreme
>ugliness:
>
> >>> class Classic:
>...   def __init__(self):
>...     super(Classic, self).__init__()
>...
> >>> c = Classic()
>Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "<stdin>", line 3, in __init__
>TypeError: super() argument 1 must be type, not classobj
>
>Could classic classes ever be removed without us having manually
>to fix all __init__ calls to the superclass?

Maybe.  If you follow the python-dev thread about "super() considered
harmful", you'll learn that Guido believes super() should only be used
with class hierarchies explicitly designed for the purpose.  Given that,
you'd have to do a lot of other changes to support super() and it's less
outrageous.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"19. A language that doesn't affect the way you think about programming,
is not worth knowing."  --Alan Perlis



More information about the Python-list mailing list