[Python-Dev] Re: multimethods (quelle horreur?) (clarification)

Samuele Pedroni pedroni@inf.ethz.ch
Sun, 18 Aug 2002 11:59:03 +0200


[David Abrahams]
>
>[myself]
>> gf(a,b,_redispatch=(None,SuperTypeOf_b))
>>
>> the dispatch mechanism will consider the
>> tuple (type(a),SuperTypeOf_b) instead
>>  of (type(a),type(b)) for dispatching.
>
>More "sugarily:"
>
>    gf(a, dispatch_as(b, SuperTypeOf_b))
>
>Interesting. Not sure how I feel about this.
>
>>  This is the moral equivalent of
>>  single dispatching:
>>
>>  SuperTypeOf_b.meth(b)

what I described above corresponds
to this.

>>
>>  or super(SuperTypeOf_b).meth(b)

to be quivalent with that

gf(a, dispatch_as(b, SuperTypeOf_b))

would have to consider
SuperType_Of_b but together with
the order induced by type(b).mro().

regards.