-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Document collections.defaultdict parameter default_factory #85787
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
Comments
How to reproduce >>> from collections import defaultdict
>>> dd = defaultdict(default_factory=list)
>>> dd
defaultdict(None, {'default_factory': <class 'list'>})
>>> print(dd.default_factory)
None Analysis Expect: |
This is intentional behaviour, the factory can only be passed as a positional argument. The documentation[1] mentions this, although its probably possible to write this a bit clearer. [1] https://docs.python.org/3.8/library/collections.html#collections.defaultdict |
PR 21945 changes the signature:
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: