New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-37116: Use PEP 570 syntax for positional-only parameters. #13700
bpo-37116: Use PEP 570 syntax for positional-only parameters. #13700
Conversation
@@ -52,6 +52,8 @@ def capwords(s, sep=None): | |||
import re as _re | |||
from collections import ChainMap as _ChainMap | |||
|
|||
_sentinel_dict = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use object()
? IIUC all the code below checks for its identity first and then substitutes another dict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because semantically the default value for the mapping parameter is an empty dict. The check mapping is _sentinel_dict
is merely an optimization (we can avoid to create a ChainMap in this case).
Thank you very much @serhiy-storchaka for working on this |
Yes, we can add With bpo-36518 we should not even add it if all positional arguments are required (this covers the majority of cases). |
@pablogsal The two last bugs related to positional-only arguments I found when worked on this issue. |
|
Based on #12620 but contains only changes that can be applied in 3.8. E.g. only getting rid of
*args
and name tricks and makingself
andcls
positional-only.https://bugs.python.org/issue37116