[Python-ideas] simpler super() syntax

Arne Babenhauserheide arne_bab at web.de
Fri Feb 22 09:53:32 CET 2008


I just spent some time figuring out how and why super needs to be called with 
*args and **kwds in any class, when I use multiple inheritance (or when some 
subclass wants to use it), and I got the impression, that simply every class 
should take *args and **kwds and that super should be called inside the init 
of every class. 

Would it make sense to make the init of any class take *args and **kwds 

With that, arguments and keywords would always be passed on (the behaviour we 
need as soon as we use any multiple inheritance) and the code would look 
cleaner (I think). 

At the moment the code for a class with MI looks like this: 

class Blah(Blubb): 
	def __init__(*args, **kwds)
		super(Blah, self).__init__(*args, **kwds)

with implicit *args and **kwds, it would look like this: 

class Blah(Blubb): 
	def __init__()
		super(Blah, self).__init__()

And by calling super, I implicitely say, that i want to pass on any leftover 
args or kwds which (to my knowledge) I must do anyway, since else I am in 
danger of getting MI bugs. 

What do you think? 

Best wishes, 
Unpolitisch sein
Heißt politisch sein
Ohne es zu merken. 
- Arne Babenhauserheide ( http://draketo.de )
-- Weblog: http://blog.draketo.de

-- Mein öffentlicher Schlüssel (PGP/GnuPG): 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20080222/db049c66/attachment.pgp>

More information about the Python-ideas mailing list