bpo-37116: Use PEP 570 syntax for positional-only parameters.#13700
Conversation
gvanrossum
left a comment
There was a problem hiding this comment.
All LGTM. Very nice cleanups!
It looks like we technically have to add / whenever there's a **kwds (assuming the kwds is passed through and could contain any key)...
| import re as _re | ||
| from collections import ChainMap as _ChainMap | ||
|
|
||
| _sentinel_dict = {} |
There was a problem hiding this comment.
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.
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 🎉 |
ilevkivskyi
left a comment
There was a problem hiding this comment.
typing/abc/collections code LGTM.
|
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. |
tirkarthi
left a comment
There was a problem hiding this comment.
mock changes LGTM. There are few places where _mock_self is used in the async helpers later assigning to self following older pattern. I will try to change them in another PR so that this is good for beta 1. Thanks Serhiy.
|
Based on #12620 but contains only changes that can be applied in 3.8. E.g. only getting rid of
*argsand name tricks and makingselfandclspositional-only.https://bugs.python.org/issue37116