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

Raymond Hettinger raymond.hettinger at gmail.com
Fri Oct 4 22:38:05 CEST 2013


On Sep 22, 2013, at 6:16 PM, Ethan Furman <ethan at stoneleaf.us> wrote:

Are we close to asking for pronouncement?

When you're ready, let me know.

In the meantime, I conducting usability tests on students in Python classes and researching how well it substitutes for existing solutions for case insensitive dictionaries (the primary use case) and for other existing cases such as dictionaries with unicode normalized keys.

If you want to participate in the research, I could also use help looking at what other languages do. Python is not the first language with mappings or to encounter use cases for transforming keys prior to insertion and lookup. I would like to find out what work has already been done on this problem.

Another consideration is whether the problem is more general that just dictionaries. Would you want similar functionality in all mapping-like objects (i.e. a persistent dictionaries, os.environ, etc)? Would you want similar functionality for other services (i.e. case-insensitive filenames or other homomorphisms).

You can also add to the discussion by trying out your own usability tests on people who haven't been exposed to this thread or the pep.

My early results indicate that the API still needs work.

David Beazley on twitter recently proposed that we add a MinDict and MaxDict. There seems to be no shortage of ideas of things that can be done with dictionaries.

Besides choosing among the dict variants, there is also confusion about other mapping topics such as 1) when to subclass from dict rather than inherit from MutableMapping, 2) the difference between defaultdict(int) and Counter's use of missing to return zero, and 3) it seems that many experienced users can't even name all the existing methods on dictionaries (they forget clear(), copy(), pop(), popitem(), setdefault(), update() and the fromkeys() classmethod).

Overall, my impression at this point is that key transformations are useful, but I'm not sure how to incorporate them without taking Python further away from being a language "that just fits in your head."

Raymond -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20131004/eae27968/attachment.html>



More information about the Python-Dev mailing list