Skip to content

Commit e455fc1

Browse files
committed
fix broken ref and inconsistent writing style
1 parent c158b54 commit e455fc1

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

Doc/library/collections.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -744,11 +744,13 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
744744

745745
.. method:: __getitem__(key, /)
746746

747-
Does exactly the same thing as :meth:`dict.__getitem__`, but in a more
748-
:term:`thread-safe` way. When :term:`free threading` is enabled, the
749-
defaultdict is locked while the key is being looked up and the
750-
:meth:`__missing__` method is being called, thus ensuring that only one
751-
default value is generated and inserted for each missing key.
747+
Return ``self[key]``. If the item doesn't exist, the :meth:`__missing__`
748+
method is called to create it.
749+
750+
When :term:`free threading` is enabled, the defaultdict is locked while
751+
the key is being looked up and the :meth:`__missing__` method is being
752+
called, thus ensuring that only one default value is generated and
753+
inserted for each missing key.
752754

753755
.. method:: __missing__(key, /)
754756

Modules/_collectionsmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,8 +2225,8 @@ static PyType_Spec defdict_spec;
22252225

22262226
PyDoc_STRVAR(defdict_getitem_doc,
22272227
"__getitem__($self, key, /)\n--\n\n\
2228-
Return self[key]. Try to create the item if it doesn't exist, by calling\n\
2229-
self.__missing__(key).\
2228+
Return self[key]. If the item doesn't exist, self.__missing__(key) is called\n\
2229+
to create it.\
22302230
");
22312231

22322232
static PyObject *

0 commit comments

Comments
 (0)