[Python-Dev] PEP 443 - Single-dispatch generic functions

Łukasz Langa lukasz at langa.pl
Fri May 24 14:44:24 CEST 2013

On 24 maj 2013, at 14:22, Ronan Lamy <ronan.lamy at gmail.com> wrote:

>> 2013/5/24 Ethan Furman <ethan at stoneleaf.us>
>> What would you suggest happen in this case?
> Raise a ValueError, maybe? In that case, there needs to be a way to force the overriding when it is explicitly desired. One way would be to allow unregistering implementations: overriding is then done by unregistering the old implementation before defining the new one.

Unfortunately this isn't going to work because the order of imports
might change during the life cycle of a program. Especially if you
wish to expose registering to users, the order of imports cannot be

I recognize the need for such behaviour to be discoverable. This is
important for debugging purposes. This is why I'm going to let users
inspect registered overloads, as well as provide their own mapping
for the registry. I'm working on the reference implementation now,
stay tuned.

Best regards,
Łukasz Langa

WWW: http://lukasz.langa.pl/
Twitter: @llanga
IRC: ambv on #python-dev

More information about the Python-Dev mailing list