On 03/01/2017 11:41 PM, Stephan Houben wrote:
I have a slight variant of the decorator proposal.
Rather than specify a count, let the decorator implement the typeshed dunder
convention:
@positional_only
def replace(self, __old, __new, count=-1):
(I imagine this decorator would also treat "self" as position_only,
so no need for __self.)
Pros:
1. Consistent with the typeshed convention.
Only a pro if you like that convention. ;)
2. Avoids a count.
3. Strictly opt-in, so hopefully keeps those @#?! underscore preservationists
from picketing my lawn (again!).
Using a decorator is also strictly opt-in.
Oh, and did someone say it was time for the protest?
[----------------------] [----------------------]
[ ] [ ]
[ NO MORE UNDERSCORES! ] [ NO MORE UNDERSCORES! ]
[ ] [ ]
[----------------------] [----------------------]
| | | |
| | | |
| | | |
| | | |
|-| |-|
--
~Ethan~
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/