[Python-Dev] PEP 455: TransformDict (original) (raw)
Georg Brandl g.brandl at gmx.net
Sat Sep 14 07:21:00 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 11:45 PM, Antoine Pitrou wrote:
On Fri, 13 Sep 2013 23🔞39 +0300 Serhiy Storchaka <storchaka at gmail.com> wrote:
13.09.13 23:02, Antoine Pitrou написав(ла): > On Fri, 13 Sep 2013 16:54:01 -0300 > "Joao S. O. Bueno" <jsbueno at python.org.br> wrote: >> I see the PEP does not contemplate a way to retrieve the original key >> - like we've talked about somewhere along the thread. > > Indeed. If that's important I can add it. I was hoping to keep very > close to the MutableMapping API, to make the PEP as few > controversial as possible.
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'
Except that getitem is very close to getitem, which will be confusing. (Although it would be the correct name, and getitem is the wrong one).
cheers, Georg
- Previous message: [Python-Dev] PEP 455: TransformDict
- Next message: [Python-Dev] PEP 455: TransformDict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]