This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients lukasz.langa, ncoghlan, pitrou, rhettinger
Date 2015-07-09.13:41:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1436449272.49.0.843794258637.issue24597@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-07-09 13:41:12pitrousetrecipients: + pitrou, rhettinger, ncoghlan, lukasz.langa
2015-07-09 13:41:12pitrousetmessageid: <1436449272.49.0.843794258637.issue24597@psf.upfronthosting.co.za>
2015-07-09 13:41:12pitroulinkissue24597 messages
2015-07-09 13:41:12pitroucreate