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/2013-September/128517.html below:

[Python-Dev] Add a "transformdict" to collections

[Python-Dev] Add a "transformdict" to collections [Python-Dev] Add a "transformdict" to collectionsEthan Furman ethan at stoneleaf.us
Tue Sep 10 16:00:17 CEST 2013
On 09/10/2013 06:09 AM, Hrvoje Niksic wrote:
> On 09/10/2013 02:24 PM, Paul Moore wrote:
>>>>> td['FOO'] = 42
>>>>> td['foo'] = 32
>>>>> list(td.keys())
>>
>> ['FOO'] or ['foo']? Both answers are justifiable.
>
> Note that the same question can be reasonably asked for dict itself:
>
>>>> d = {}
>>>> d[1.0] = 'foo'
>>>> d[1] = 'bar'
>>>> d
> {1.0: 'bar'}
>
> So, dict.__setitem__ only replaces the value, leaving the original key in place. transformdict should probably do the
> same, returning 'FOO' in your example.

+1
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