A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-April/111126.html below:

[Python-Dev] What if replacing items in a dictionary returns the new dictionary?

[Python-Dev] What if replacing items in a dictionary returns the new dictionary? [Python-Dev] What if replacing items in a dictionary returns the new dictionary?Mark Shannon marks at dcs.gla.ac.uk
Fri Apr 29 16:36:01 CEST 2011
Roy Hyunjin Han wrote:
> It would be convenient if replacing items in a dictionary returns the
> new dictionary, in a manner analogous to str.replace().  What do you
> think?
> ::
> 
>     # Current behavior
>     x = {'key1': 1}
>     x.update(key1=3) == None
>     x == {'key1': 3} # Original variable has changed
> 
>     # Possible behavior
>     x = {'key1': 1}
>     x.replace(key1=3) == {'key1': 3}
>     x == {'key1': 1} # Original variable is unchanged
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/marks%40dcs.gla.ac.uk
> 

Could you please post this to python-ideas, rather than python-dev
Python-dev is about aspects of the implementation,
not significant language changes.

Mark.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4