
Hi, 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 implicitely? 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, Arne -- 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): http://draketo.de/inhalt/ich/pubkey.txt

Hi, At the moment the code for a class with MI looks like this:
From Blah.__init__ how would you call super(Blah, self).__init__ if you explicitely do not want to pass any arguments to it?
super(Blah, self).__init(*[],**{}) ? :) If your only concern is that you have to type "*args, **kwds" too many times, maybe something the following could be introduced: def __init__(*): super(Blah, self).__init__(*) so * would mean whatever argument is given to the function. Or we similarly to *args and **kwds possibly the new syntax ***allargs could be introduced which would mean a tuple of *args and **kwds. That could be abbreviated as ***a -> it is much sorter and easier to type, yet it is implicit. Istvan

(a) In Py3k, you will be able to use super() itself without args, e.g. super().__init__(*args) (b) There are lots of reasons why you would not want to pass the args to your super method *unchanged*. Also, super methods may have defaults for all args. So super.__init__() would be ambiguous -- does he want to pass all args or none? Because of this I am strongly against this. On Fri, Feb 22, 2008 at 12:53 AM, Arne Babenhauserheide <arne_bab@web.de> wrote:
-- --Guido van Rossum (home page: http://www.python.org/~guido/)

Hi, At the moment the code for a class with MI looks like this:
From Blah.__init__ how would you call super(Blah, self).__init__ if you explicitely do not want to pass any arguments to it?
super(Blah, self).__init(*[],**{}) ? :) If your only concern is that you have to type "*args, **kwds" too many times, maybe something the following could be introduced: def __init__(*): super(Blah, self).__init__(*) so * would mean whatever argument is given to the function. Or we similarly to *args and **kwds possibly the new syntax ***allargs could be introduced which would mean a tuple of *args and **kwds. That could be abbreviated as ***a -> it is much sorter and easier to type, yet it is implicit. Istvan

(a) In Py3k, you will be able to use super() itself without args, e.g. super().__init__(*args) (b) There are lots of reasons why you would not want to pass the args to your super method *unchanged*. Also, super methods may have defaults for all args. So super.__init__() would be ambiguous -- does he want to pass all args or none? Because of this I am strongly against this. On Fri, Feb 22, 2008 at 12:53 AM, Arne Babenhauserheide <arne_bab@web.de> wrote:
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (3)
-
Arne Babenhauserheide
-
Guido van Rossum
-
Szekeres István