multimethod (or rather overloading) in Python
anton muhin
antonmuhin at rambler.ru
Mon Feb 21 14:04:58 EST 2005
Nick Coghlan wrote:
> anton muhin wrote:
>
>> anton muhin wrote:
>>
>> Correction:
>>
>>> Of course, I can imagine some metaclasses magic that would allow to
>>> code:
>>>
>>> class MyClass(WithOverloading):
>>> @overloadMethod(A)
>>> def someMetod(self, _): ...
>>>
>>> But it would rather convoluted: the best idea I have so far is to
>>> mangle methods name in the manner most of C++ compilers do.
>
>
> PEAK has a fairly sophisticated implementation of method dispatch you
> may want to look at.
>
> http://peak.telecommunity.com/Articles/WhatisPEAK.html
> http://dirtsimple.org/2004/11/generic-functions-have-landed.html
> http://peak.telecommunity.com/doc/src/dispatch/__init__.html
>
> I'm compelled to point out that PEAK should still be considered a 'work
> in progress', but PJE's ideas should help you out :)
>
> Cheers,
> Nick.
>
Thank you very much, Nick!
anton.
More information about the Python-list
mailing list