[Python-Dev] PEP 443 - Single-dispatch generic functions
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,
IRC: ambv on #python-dev
More information about the Python-Dev