mirror of
https://github.com/python/cpython.git
synced 2025-12-05 00:52:25 +00:00
bpo-41621: Document defaultdict's default_factory parameter (GH-21945)
It defaults to None and is positional only.
This commit is contained in:
parent
adfa1ba398
commit
d1ae57027f
3 changed files with 4 additions and 3 deletions
|
|
@ -707,9 +707,9 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
|
||||||
:class:`defaultdict` objects
|
: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
|
built-in :class:`dict` class. It overrides one method and adds one writable
|
||||||
instance variable. The remaining functionality is the same as for the
|
instance variable. The remaining functionality is the same as for the
|
||||||
:class:`dict` class and is not documented here.
|
:class:`dict` class and is not documented here.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Document that :class:`collections.defaultdict` parameter ``default_factory`` defaults to None and is positional-only.
|
||||||
|
|
@ -2241,7 +2241,7 @@ defdict_init(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(defdict_doc,
|
PyDoc_STRVAR(defdict_doc,
|
||||||
"defaultdict(default_factory[, ...]) --> dict with default factory\n\
|
"defaultdict(default_factory=None, /, [...]) --> dict with default factory\n\
|
||||||
\n\
|
\n\
|
||||||
The default factory is called without arguments to produce\n\
|
The default factory is called without arguments to produce\n\
|
||||||
a new value when a key is not present, in __getitem__ only.\n\
|
a new value when a key is not present, in __getitem__ only.\n\
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue