Re: [Python-Dev] 2.6 object.__init__ & deling __new__

At 04:11 PM 7/14/2009 -0500, Benjamin Peterson wrote:
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. :-(

P.J. Eby wrote:
In effect, 2.6 forces you to have a common known base class *other* than 'object' in order to write co-operative classes. :-(
You have to do that anyway if you want to make cooperative calls to any method *other* that __init__. -- Greg

At 07:29 PM 7/15/2009 +1200, Greg Ewing wrote:
I haven't found that to be an issue, actually, since there's usually a base where the "bottom" version of those methods live, and anything implementing those methods is going to inherit it via the mixin. The problem is that for at least __init__ and __new__, 'object' *is* the "bottom" -- and there may be more than one family of mixins that need to call it.

P.J. Eby wrote:
In effect, 2.6 forces you to have a common known base class *other* than 'object' in order to write co-operative classes. :-(
You have to do that anyway if you want to make cooperative calls to any method *other* that __init__. -- Greg

At 07:29 PM 7/15/2009 +1200, Greg Ewing wrote:
I haven't found that to be an issue, actually, since there's usually a base where the "bottom" version of those methods live, and anything implementing those methods is going to inherit it via the mixin. The problem is that for at least __init__ and __new__, 'object' *is* the "bottom" -- and there may be more than one family of mixins that need to call it.
participants (2)
-
Greg Ewing
-
P.J. Eby