[issue24597] forbid redefinition of specializations in singledispatch

2015-07-21 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: -ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Eric Snow
Eric Snow added the comment: I agree with Antoine. -- nosy: +eric.snow ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 09/07/2015 20:30, Ethan Furman a écrit : > > That doesn't feel like a consenting-adults attitude, and could also make testing harder. Testing of what? The point is that it's the authority providing the generic function which decides how lenient extending the

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Ethan Furman
Ethan Furman added the comment: Ah, I see. So you say up-front if you are willing to have redefinition occur later. That doesn't feel like a consenting-adults attitude, and could also make testing harder. I prefer adding an option to the register method, and move towards making the default b

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ah, but I wasn't suggesting to add an argument to the .register() call, but to the singledispatch() call; i.e. it would be a function-wide parameter. -- ___ Python tracker ___

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread R. David Murray
R. David Murray added the comment: Yes it is too late. You'd have to do a couple of deprecation cycles to change the default. -- nosy: +r.david.murray ___ Python tracker ___ __

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Ethan Furman
Ethan Furman added the comment: Sure. I just saying that @f.register(int, replace=True) requires opt-in to replacing, whilst @f.register(int, replace=False) # don't replace if one already exists is still prone to bugs. -- ___ Python tracker

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't know. I'm assuming some people actually want to redefine existing specializations. -- ___ Python tracker ___ __

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Ethan Furman
Ethan Furman added the comment: Is it too late to have the default for that option be to not allow the replacement? That would be the safer course. -- nosy: +ethan.furman ___ Python tracker __

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Antoine Pitrou
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