[Python-3000] Adaptation vs. Generic Functions

Gustavo Niemeyer gustavo at niemeyer.net
Thu Apr 6 15:08:01 CEST 2006


> What I'd like to see is how this changes if we use a generic functions
> (multiple dispatch) implementation instead of adaptation. Adaptation
> is pretty much isomorphic with a generic function of one argument (see
> my blog). But the register_for() method couldn't (shouldn't) interpret
> multiple arguments as multiple registrations; it should probably take
> this to match the call signature.

Zope interfaces support multi-adapters, and they're very useful in
certain cases. I belive this would match pretty well with a generic
function with more than a single argument.

If somebody is curious about the logic used to lookup adapters, the
interesting part is in zope.interface.adapter.AdapterLookup.lookup().

-- 
Gustavo Niemeyer
http://niemeyer.net


More information about the Python-3000 mailing list