[Python-Dev] PEP 455: TransformDict (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Sun Sep 15 15:57:07 CEST 2013


On Sun, 15 Sep 2013 16:14:24 +0300 Serhiy Storchaka <storchaka at gmail.com> wrote:

15.09.13 14:23, Antoine Pitrou написав(ла): > On Sun, 15 Sep 2013 13:56:26 +0900 > Larry Hastings <larry at hastings.org> wrote: >> On 09/14/2013 07:30 PM, Antoine Pitrou wrote: >>> On Sat, 14 Sep 2013 14:33:56 +0900 >>> Larry Hastings <larry at hastings.org> wrote: >>>> 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. >> >> s/normal dict/normal set/ > > No, read my example.

A TransformDict is like a normal dict, you just need to call the transformation function yourself when inserting the keys and insert a pair of (origkey, value), or is like two normal dicts, you just need to call the transformation function yourself when inserting the keys and update parallel mapping from transformed keys to original keys.

I don't really care. What's the point in the end? TransformDict is non-trivial to implement, while the so-called "TransformSet" is just a dict with a different API.



More information about the Python-Dev mailing list