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/128519.html below:

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

[Python-Dev] Add a "transformdict" to collections [Python-Dev] Add a "transformdict" to collectionsAndrea Corbellini corbellini.andrea at gmail.com
Tue Sep 10 11:37:01 CEST 2013
On Tue, Sep 10, 2013 at 11:28 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Therefore I propose adding the general pattern. Simple example:
>
>    >>> d = transformdict(str.lower)
>    >>> d['Foo'] = 5
>    >>> d['foo']
>    5
>    >>> d['FOO']
>    5
>    >>> list(d)
>    ['Foo']
>
> (case-insensitive but case-preserving, as the best filesystems are ;-))

Just a nitpick: if this example (or a similar one) gets into the
documentation, it would be better to replace str.lower() with
str.casefold().
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