[Tutor] super() and inherited attributes?

jfouhy@paradise.net.nz jfouhy at paradise.net.nz
Tue Jun 28 10:07:30 CEST 2005


Quoting Alan G <alan.gauld at freenet.co.uk>:

> I don't know the direct answer but the more common way 
> of doing that in Python is not to use super() but just 
> call the inherited constructor directly:
> 
> Parent.__init__(self,'I am a child')
> 
> 
> SO if you just want to fix the itch use that, if you want 
> to understand super() then that won't help and its over to 
> someone else! :-)

OTOH, there are reasons for prefering super over a direct call.

This explains it better than I could:
http://www.python.org/2.2.3/descrintro.html#cooperation

-- 
John.


More information about the Tutor mailing list