Dispatching operations to user-defined methods

Hallvard B Furuseth h.b.furuseth at usit.uio.no
Mon May 8 11:38:00 CEST 2006


Michele Simionato writes:
> Apparently Guido fell in love with generic functions, so
> (possibly) in future Python versions you will be able to
> solve dispatching problems in in an industrial strenght way.

Looks interesting, I'll keep an eye on that.

> Sometimes however the simplest possible way is enough, and you
> can use something like this :
>
> class SimpleDispatcher(object):
> (...)

That doesn't make use of any subclass hierarchies the user defines
though.  But maybe it's just as well to scan his class for names
once he has defined it, and build the dispatch table myself.

-- 
Hallvard



More information about the Python-list mailing list