[Python-Dev] PEP 455: TransformDict (original) (raw)
Ethan Furman ethan at stoneleaf.us
Sat Sep 14 00:32:55 CEST 2013
- Previous message: [Python-Dev] PEP 455: TransformDict
- Next message: [Python-Dev] PEP 455: TransformDict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 09/13/2013 02:45 PM, Antoine Pitrou wrote:
Serhiy Storchaka wrote:
I think that's important. As OrderectDict has additional methods besides the MutableMapping API, so TransformDict should provide useful specialized methods. Ok, I have a better (IMO) proposal: >>> d = TransformDict(str.casefold, {'Foo': 1}) >>> d.getitem('foo') ('Foo', 1) >>> d.getitem('bar') Traceback (most recent call last): File "", line 1, in KeyError: 'bar'
-1
When I want the canonical key, I'm not going to care about the value; and if I do, it's easy enough to get.
--
Ethan
- Previous message: [Python-Dev] PEP 455: TransformDict
- Next message: [Python-Dev] PEP 455: TransformDict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]