This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: dict.update() return the updated dict instead of None
Type: enhancement Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: AL3X_69, SilentGhost, corona10, xtreak
Priority: normal Keywords:

Created on 2020-04-18 11:57 by AL3X_69, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg366703 - (view) Author: (AL3X_69) Date: 2020-04-18 11:57
When a dict is updated with update(), instead of return None, it will return the updated dict.

example: 

>>> a = {"test": 1}
>>> b = {"type": 2}
>>> c = a.update(b)
>>> print(c)
{"test": 1, "type": 1}
msg366704 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2020-04-18 12:25
Can you please print the output of python -v? Using python 3.8.0 on Linux returns None for update method.
msg366705 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-04-18 12:40
Python 3.9.0a5+ (heads/master:c606624af8, Apr 18 2020, 18:42:51)
[Clang 11.0.3 (clang-1103.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = {"test": 1}
>>> b = {"type": 2}
>>> c = a.update(b)
>>> print(c)
None

on macOS master branch, the issue is not reproducible.
msg366706 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-04-18 12:44
Python 3.8.2+ (heads/3.8:c496e29c2b, Apr 18 2020, 21:42:41)
[Clang 11.0.3 (clang-1103.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = {"test": 1}
>>> b = {"type": 2}
>>> c = a.update(b)
>>> print(c)
None
msg366710 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2020-04-18 13:26
This looks like a proposed "enhancement" rather than a bug report. Unfortunately, this is not possible for a myriad of reasons, from backward compatibility to overall use of mutating methods in Python.
History
Date User Action Args
2022-04-11 14:59:29adminsetgithub: 84499
2020-04-18 13:26:55SilentGhostsetstatus: open -> closed

nosy: + SilentGhost
messages: + msg366710

resolution: rejected
stage: resolved
2020-04-18 12:44:39corona10setmessages: + msg366706
2020-04-18 12:40:54corona10setnosy: + corona10
messages: + msg366705
2020-04-18 12:25:29xtreaksetmessages: + msg366704
2020-04-18 12:21:59xtreaksetnosy: + xtreak
2020-04-18 11:57:55AL3X_69create