]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-116938: Fix `dict.update` docstring and remove erraneous full stop from `dict...
authorPrometheus3375 <35541026+Prometheus3375@users.noreply.github.com>
Tue, 29 Oct 2024 23:00:04 +0000 (02:00 +0300)
committerGitHub <noreply@github.com>
Tue, 29 Oct 2024 23:00:04 +0000 (23:00 +0000)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Doc/library/stdtypes.rst
Objects/dictobject.c

index 704637d675ead3fe78507c52da4e1c5ee99b187f..a9b7662dcb212b7666ca0873888ba67b95829f0d 100644 (file)
@@ -4674,7 +4674,7 @@ can be used interchangeably to index the same dictionary entry.
 
       :meth:`update` accepts either another object with a ``keys()`` method (in
       which case :meth:`~object.__getitem__` is called with every key returned from
-      the method). or an iterable of key/value pairs (as tuples or other iterables
+      the method) or an iterable of key/value pairs (as tuples or other iterables
       of length two). If keyword arguments are specified, the dictionary is then
       updated with those key/value pairs: ``d.update(red=1, blue=2)``.
 
index 68ba2f74fdc67a2fd90c8d4bd987f7b8b05032e4..f28a92657834be612abcd73c51d5edd478549a05 100644 (file)
@@ -4673,8 +4673,8 @@ PyDoc_STRVAR(getitem__doc__,
 "__getitem__($self, key, /)\n--\n\nReturn self[key].");
 
 PyDoc_STRVAR(update__doc__,
-"D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.\n\
-If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]\n\
+"D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.\n\
+If E is present and has a .keys() method, then does:  for k in E.keys(): D[k] = E[k]\n\
 If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v\n\
 In either case, this is followed by: for k in F:  D[k] = F[k]");