Message246493
singledispatch currently doesn't defend against unwanted redefinition of an existing specialization, e.g.:
>>> def f(x): return "default"
...
>>> f = functools.singledispatch(f)
>>> @f.register(int)
... def _(x): return "1"
...
>>> @f.register(int)
... def _(x): return "2"
...
>>> f(42)
'2'
This can be annoying when used as an extension mechanism. It would be nice if at least an option in the singledispatch() constructor could prevent this. |
|
Date |
User |
Action |
Args |
2015-07-09 13:41:12 | pitrou | set | recipients:
+ pitrou, rhettinger, ncoghlan, lukasz.langa |
2015-07-09 13:41:12 | pitrou | set | messageid: <1436449272.49.0.843794258637.issue24597@psf.upfronthosting.co.za> |
2015-07-09 13:41:12 | pitrou | link | issue24597 messages |
2015-07-09 13:41:12 | pitrou | create | |
|