--- this message got only to Guido by error - I only now found out, so I forwarded it here. ---
(b) I though about this a lot, but only two weeks ago I realized, why my idea was moot. It just took a bit of time.
The reason is simple (though it took me quite some time to find it):
There are times, where I might want to put an additional argument between the *args and the **kwds.
class A(): def __init__(a, b, c=d): pass
class B(A): def __init__(a, c=d): super().__init__(*args, b, **kwds)
So the way Python does it is the simplest possibility, which doesn't cripple the language on the long run.
And that's a nice result, too :)
Thank you for answering, even though my idea was flawed.
Best wishes, Arne
El Friday, 22 de February de 2008 17:12:31 escribió:
(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 email@example.com
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
Python-ideas mailing list Pythonfirstname.lastname@example.org http://mail.python.org/mailman/listinfo/python-ideas