https://github.com/python/cpython/commit/1fc1a185edee02ea04b6859706d178146aa0f77f commit: 1fc1a185edee02ea04b6859706d178146aa0f77f branch: 3.12 author: Miss Islington (bot) <[email protected]> committer: AA-Turner <[email protected]> date: 2024-10-29T23:22:20Z summary:
[3.12] gh-116938: Fix `dict.update` docstring and remove erraneous full stop from `dict` documentation (GH-125421) (#126151) 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 <[email protected]> Co-authored-by: Adam Turner <[email protected]> files: M Doc/library/stdtypes.rst M Objects/dictobject.c diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 0c1f29d8b69d97..cc67a378d5906f 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4626,7 +4626,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 0712bedc838eee..4e965314945aca 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -3634,8 +3634,8 @@ PyDoc_STRVAR(sizeof__doc__, "D.__sizeof__() -> size of D in memory, in bytes"); 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]"); _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
