Metaclass with name overloading.
Alex Martelli
aleaxit at yahoo.com
Mon Sep 27 16:41:43 EDT 2004
Ville Vainio <ville at spammers.com> wrote:
...
> >>>>> "Alex" == Alex Martelli <aleaxit at yahoo.com> writes:
>
> Alex> For overload purposes, you might have the decorator actually
> Alex> take as arguments some _types_ and record them so that the
> Alex> metaclass can arrange for the dispatching based on
> Alex> actual-argument types...
>
> I believe several implementations of generic functions/multimethods in
> Python exist already; Quick googling brings up
>
> http://mail.python.org/pipermail/python-dev/2004-April/043902.html
They exist, but you can't just 'def thesamename(....):' more than once
within a class, which is what the OP asked for. Building on Heller's
hint I showed how to allow that with a decorator, that's all.
Alex
More information about the Python-list
mailing list