On Sat, 14 Sep 2013 14:33:56 +0900
Larry Hastings <[email protected]> wrote:
> On 09/14/2013 03:40 AM, Antoine Pitrou wrote:
> > Hello,
> >
> > Following the python-dev discussion, I've written a PEP to recap the
> > proposal and the various arguments. It's inlined below, and it will
> > probably appear soon at http://www.python.org/dev/peps/pep-0455/, too.
>
> Whenever I read a discussion about the dict, I always wonder whether the
> same thing applies to a set. Have you considered the utility of a
> TransformSet? Or is it YAGNI?
Well, a TransformSet is like a normal dict, you just need to call the
transformation function yourself when inserting the keys.
i.e.:
d = TransformSet(str.lower)
d.add('Foo')
is the same conceptually as:
d = {}
d['Foo'.lower()] = 'Foo'
d['foo'] # gets the original key
Regards
Antoine.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com