]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41621: Document defaultdict's default_factory parameter (GH-21945)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 22 Jun 2021 14:42:41 +0000 (07:42 -0700)
committerGitHub <noreply@github.com>
Tue, 22 Jun 2021 14:42:41 +0000 (07:42 -0700)
It defaults to None and is positional only.
(cherry picked from commit d1ae57027fc39ff60dcfc1b63881400e5ca3ce56)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
Doc/library/collections.rst
Misc/NEWS.d/next/Documentation/2020-08-24-13-35-04.bpo-41621.nqaw9G.rst [new file with mode: 0644]
Modules/_collectionsmodule.c

index 4dc1b9fc2ec74971a2fcb9864bb09c1152c5f3f1..5189a2e88a6ce183c4af0b278718a157739e0abb 100644 (file)
@@ -685,9 +685,9 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
 :class:`defaultdict` objects
 ----------------------------
 
-.. class:: defaultdict([default_factory[, ...]])
+.. class:: defaultdict(default_factory=None, /, [...])
 
-    Returns a new dictionary-like object.  :class:`defaultdict` is a subclass of the
+    Return a new dictionary-like object.  :class:`defaultdict` is a subclass of the
     built-in :class:`dict` class.  It overrides one method and adds one writable
     instance variable.  The remaining functionality is the same as for the
     :class:`dict` class and is not documented here.
diff --git a/Misc/NEWS.d/next/Documentation/2020-08-24-13-35-04.bpo-41621.nqaw9G.rst b/Misc/NEWS.d/next/Documentation/2020-08-24-13-35-04.bpo-41621.nqaw9G.rst
new file mode 100644 (file)
index 0000000..bd193d9
--- /dev/null
@@ -0,0 +1 @@
+Document that :class:`collections.defaultdict` parameter ``default_factory`` defaults to None and is positional-only.
index 7120e4dda0ed236cd99c420e4d483aa40b6b8d9a..2e19b83dcec6fe17c277a6c85b7aae3ba2821e8b 100644 (file)
@@ -2213,7 +2213,7 @@ defdict_init(PyObject *self, PyObject *args, PyObject *kwds)
 }
 
 PyDoc_STRVAR(defdict_doc,
-"defaultdict(default_factory[, ...]) --> dict with default factory\n\
+"defaultdict(default_factory=None, /, [...]) --> dict with default factory\n\
 \n\
 The default factory is called without arguments to produce\n\
 a new value when a key is not present, in __getitem__ only.\n\