[New-bugs-announce] [issue24597] forbid redefinition of specializations in singledispatch
Antoine Pitrou
report at bugs.python.org
Thu Jul 9 15:41:12 CEST 2015
New submission from Antoine Pitrou:
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.
----------
components: Library (Lib)
messages: 246493
nosy: lukasz.langa, ncoghlan, pitrou, rhettinger
priority: normal
severity: normal
status: open
title: forbid redefinition of specializations in singledispatch
type: enhancement
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24597>
_______________________________________
More information about the New-bugs-announce
mailing list