New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dict.update() return the updated dict instead of None #84499
Comments
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} |
Can you please print the output of python -v? Using python 3.8.0 on Linux returns None for update method. |
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. |
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 |
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. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: