Skip to content
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

Closed
AL3X-69 mannequin opened this issue Apr 18, 2020 · 5 comments
Closed

dict.update() return the updated dict instead of None #84499

AL3X-69 mannequin opened this issue Apr 18, 2020 · 5 comments
Labels
3.8 only security fixes type-feature A feature request or enhancement

Comments

@AL3X-69
Copy link
Mannequin

AL3X-69 mannequin commented Apr 18, 2020

BPO 40319
Nosy @corona10, @tirkarthi, @AL3X-69

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:

assignee = None
closed_at = <Date 2020-04-18.13:26:55.634>
created_at = <Date 2020-04-18.11:57:55.598>
labels = ['type-feature', '3.8']
title = 'dict.update() return the updated dict instead of None'
updated_at = <Date 2020-04-18.13:26:55.625>
user = 'https://github.com/AL3X-69'

bugs.python.org fields:

activity = <Date 2020-04-18.13:26:55.625>
actor = 'SilentGhost'
assignee = 'none'
closed = True
closed_date = <Date 2020-04-18.13:26:55.634>
closer = 'SilentGhost'
components = []
creation = <Date 2020-04-18.11:57:55.598>
creator = 'AL3X_69'
dependencies = []
files = []
hgrepos = []
issue_num = 40319
keywords = []
message_count = 5.0
messages = ['366703', '366704', '366705', '366706', '366710']
nosy_count = 4.0
nosy_names = ['SilentGhost', 'corona10', 'xtreak', 'AL3X_69']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue40319'
versions = ['Python 3.8']

@AL3X-69
Copy link
Mannequin Author

AL3X-69 mannequin commented Apr 18, 2020

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}

@AL3X-69 AL3X-69 mannequin added 3.8 only security fixes type-feature A feature request or enhancement labels Apr 18, 2020
@tirkarthi
Copy link
Member

Can you please print the output of python -v? Using python 3.8.0 on Linux returns None for update method.

@corona10
Copy link
Member

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.

@corona10
Copy link
Member

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

@SilentGhost
Copy link
Mannequin

SilentGhost mannequin commented Apr 18, 2020

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.

@SilentGhost SilentGhost mannequin closed this as completed Apr 18, 2020
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 only security fixes type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants