On Tue, Sep 10, 2013 at 11:28 AM, Antoine Pitrou 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().
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com