FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-41621: Document defaultdict's default_factory parameter (GH-21945) · python/cpython@88a3342 · GitHub

/ cpython Public

Commit 88a3342

Browse files
bpo-41621: Document defaultdict's default_factory parameter (GH-21945)
It defaults to None and is positional only. (cherry picked from commit d1ae570) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
1 parent 38e021a commit 88a3342

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎Doc/library/collections.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,9 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
707707
:class:`defaultdict` objects
708708
----------------------------
709709

710-
.. class:: defaultdict([default_factory[, ...]])
710+
.. class:: defaultdict(default_factory=None, /, [...])
711711

712-
Returns a new dictionary-like object. :class:`defaultdict` is a subclass of the
712+
Return a new dictionary-like object. :class:`defaultdict` is a subclass of the
713713
built-in :class:`dict` class. It overrides one method and adds one writable
714714
instance variable. The remaining functionality is the same as for the
715715
:class:`dict` class and is not documented here.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Document that :class:`collections.defaultdict` parameter ``default_factory`` defaults to None and is positional-only.

‎Modules/_collectionsmodule.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2236,7 +2236,7 @@ defdict_init(PyObject *self, PyObject *args, PyObject *kwds)
22362236
}
22372237

22382238
PyDoc_STRVAR(defdict_doc,
2239-
"defaultdict(default_factory[, ...]) --> dict with default factory\n\
2239+
"defaultdict(default_factory=None, /, [...]) --> dict with default factory\n\
22402240
\n\
22412241
The default factory is called without arguments to produce\n\
22422242
a new value when a key is not present, in __getitem__ only.\n\

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL