From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 29 Oct 2024 23:27:33 +0000 (+0100) Subject: [3.13] gh-116938: Fix `dict.update` docstring and remove erraneous full stop from... X-Git-Tag: v3.13.1~205 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f37ac53cd31b37b7d48c526785406a1b3a96f5a9;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-116938: Fix `dict.update` docstring and remove erraneous full stop from `dict` documentation (GH-125421) (#126150) gh-116938: Fix `dict.update` docstring and remove erraneous full stop from `dict` documentation (GH-125421) (cherry picked from commit 5527c4051c0b58218ce69044f92b45f1d66ed43f) Co-authored-by: Prometheus3375 <35541026+Prometheus3375@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index c77399461edc..b5ba8060cb45 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4635,7 +4635,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)``. diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 91bc24b49a1b..fccc8e930f51 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -4625,8 +4625,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]");