| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
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 len(obj, /) and sorted() isn't documented as sorted(iterable, /, *, key=None, reverse=False). These have been used in docstrings but only as a artifact of using the argument clinic. |
Sorry, something went wrong.
len and other similar changes were discussed at https://bugs.python.org/issue37134 |
Sorry, something went wrong.
|
Currently len and sorted have the positional-only notation when using help(), but not in the HTML docs. What if we were to make the same true for defaultdict: add the =None and the slash to the __doc__, but leave the HTML documentation as is, except maybe adding something like The first (positional) argument provides...
^^^^^^^^^^^^^
Perhaps that is an appropriate compromise? |
Sorry, something went wrong.
There was a problem hiding this comment.
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.
Sorry, something went wrong.
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? |
Sorry, something went wrong.
|
Yes, I forgot about this. I have made the requested changes; please review again. I think this change is worthwhile because unlike len(obj=17), which fails immediately, defaultdict(default_factory=list) silently gives unexpected behavior. |
Sorry, something went wrong.
|
Thanks for making the requested changes! @terryjreedy: please review the changes made to this pull request. |
Sorry, something went wrong.
|
Tests/macOS: test_ssl failed. |
Sorry, something went wrong.
|
Thanks @sweeneyde for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9. |
Sorry, something went wrong.
|
GH-26850 is a backport of this pull request to the 3.10 branch. |
Sorry, something went wrong.
|
GH-26851 is a backport of this pull request to the 3.9 branch. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
default_factory cannot be passed as a keyword argument.
https://bugs.python.org/issue41621