[issue1683368] object.__init__ shouldn't allow args/kwds

Guido van Rossum report at bugs.python.org
Thu May 29 00:57:52 CEST 2014


Guido van Rossum added the comment:

Hrm. I've always thought that the key point of cooperative MI was the term *cooperative*. Consider a regular (non-constructor) method. You must have a common base class that defines this method, and *that* method shouldn't be calling the super-method (because there isn't one). All cooperative classes extending this method must derive from that base class.

It's the same for __init__ and __new__, except that you may treat each (keyword) argument as a separate method. But you must still have a point in the tree to "eat" that argument, and that point must not pass it up the super call chain.

If in a particular framework you want unrecognized keyword arguments to the constructor to be ignored, you should define a common base class from which all your cooperative subclasses inherit. But given the prevalence of *single* inheritance, 'object' shouldn't be that common base class.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1683368>
_______________________________________


More information about the Python-bugs-list mailing list