[Python-Dev] 2.6 object.__init__ & deling __new__
P.J. Eby
pje at telecommunity.com
Wed Jul 15 06:25:02 CEST 2009
At 04:11 PM 7/14/2009 -0500, Benjamin Peterson wrote:
>4. When __init__() is overridden, and the subclass __init__()
>calls object.__init__(), the latter should complain about
>excess arguments; ditto for __new__().
Actually, this rule is a PITA, because there's no good way to get rid
of the warnings when you're trying to write MRO-agnostic mixins.
In other words, it negates many of the gains that were obtained by
having new-style MROs, since you can no-longer write pass-through
constructors that leave their arguments untouched. Instead, every
class must know ahead of time whether it will be the "last" class
before 'object' -- thereby making it impossible to slip other mixins
into the chain below them.
In effect, 2.6 forces you to have a common known base class *other*
than 'object' in order to write co-operative classes. :-(
More information about the Python-Dev
mailing list