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-41621: More accurate signature for defaultdict #21945
Conversation
I believe there was a decision to not use the slash notation in the main docs because users found it to be unintelligible. For example, len() isn't documented as These have been used in docstrings but only as a artifact of using the argument clinic. |
len and other similar changes were discussed at https://bugs.python.org/issue37134 |
Currently
Perhaps that is an appropriate compromise? |
bpo-37134 added '/' to the docs for struct.unpack_from/compress/decompress, sum, and bytes/bytearray.translate. These fit under the Steering Council's case 2 (Brett Cannon, message 344753): 'a mixture of positional-only and positional-or-keyword args (i.e. "..., /, ...")'. So does this function: default_factory is positional only, where as additional args passed on to the dict can be either.
>>> dd(None, {1:1})
defaultdict(None, {1: 1})
>>> dd(None, one=1)
defaultdict(None, {'one': 1})
Approve except for the indicated minor change.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@sweeneyde I see you've made the minor change Terry requested. Is this PR ready to be reviewed again? |
Yes, I forgot about this. I have made the requested changes; please review again. I think this change is worthwhile because unlike |
Thanks for making the requested changes! @terryjreedy: please review the changes made to this pull request. |
Tests/macOS: test_ssl failed. |
Thanks @sweeneyde for the PR, and @terryjreedy for merging it |
GH-26850 is a backport of this pull request to the 3.10 branch. |
GH-26851 is a backport of this pull request to the 3.9 branch. |
default_factory
cannot be passed as a keyword argument.https://bugs.python.org/issue41621