<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 22, 2013, at 6:16 PM, Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: Arial; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">Are we close to asking for pronouncement?<span class="Apple-converted-space"> </span></span></blockquote><br></div><div>When you're ready, let me know.</div><div><br></div><div>In the meantime, I conducting usability tests on students in Python classes</div><div>and researching how well it substitutes for existing solutions for </div><div>case insensitive dictionaries (the primary use case) and for other</div><div>existing cases such as dictionaries with unicode normalized keys.</div><div><br></div><div>If you want to participate in the research, I could also use help looking</div><div>at what other languages do.  Python is not the first language with</div><div>mappings or to encounter use cases for transforming keys prior</div><div>to insertion and lookup.   I would like to find out what work has</div><div>already been done on this problem.</div><div><br></div><div>Another consideration is whether the problem is more general</div><div>that just dictionaries.  Would you want similar functionality in</div><div>all mapping-like objects (i.e. a persistent dictionaries, os.environ, etc)?</div><div>Would you want similar functionality for other services</div><div>(i.e. case-insensitive filenames or other homomorphisms).</div><div><br></div><div>You can also add to the discussion by trying out your own usability</div><div>tests on people who haven't been exposed to this thread or the pep.</div><div><br></div><div>My early results indicate that the API still needs work.</div><div><br></div><div>* When shown code that uses a TransformDict, students don't seem </div><div>to be able to deduce what the code does just from the context </div><div>(this contrasts with something like OrderedDict and Counter where</div><div>the name says what it does).   </div><div><br></div><div>* When given a description of the mechanics of a TransformDict,</div><div>they don't seem to be able to figure-out what you would do with it</div><div>without being given an example.</div><div><br></div><div>* When given a example of using a TransformDict, they understand</div><div>the example but don't seem to be able to come-up with other examples</div><div>other than the one they were just shown.  And when shown multiple </div><div>examples, they can't think of other use cases where they've ever </div><div>needed this in their own code.</div><div><br></div><div>* This contrasts with the results when I show something less general</div><div>like a CaseInsensitiveDict.  People seem to get that right away.</div><div>As you might expect, the generalized solution is harder to wrap</div><div>your head around than a specific solution with a clear name.</div><div><br></div><div>* One student asked, "why give regular dicts a key-function like </div><div>sorted(), min() and max()?"  I didn't have a good answer, but I </div><div>haven't yet had time to read this whole thread.</div><div><br></div><div>* Another issue is that we're accumulating too many dictionary</div><div>variants and that is making it difficult to differentiate and choose</div><div>between them.  I haven't found anyone (even in advanced classes</div><div>with very experienced pythonistas) would knew about</div><div>all the variations:  dict, defaultdict, Mapping, MutableMapping,</div><div>mapping views, OrderedDict, Counter, ChainMap, andTransformDict.</div><div><br></div><div>David Beazley on twitter recently proposed that we add a </div><div>MinDict and MaxDict.  There seems to be no shortage of ideas</div><div>of things that can be done with dictionaries.</div><div><br></div><div>Besides choosing among the dict variants, there is also confusion</div><div>about other mapping topics such as 1) when to subclass from dict</div><div>rather than inherit from MutableMapping, 2) the difference</div><div>between defaultdict(int) and Counter's use of __missing__ to return zero,</div><div>and 3) it seems that many experienced users can't even name all the</div><div>existing methods on dictionaries (they forget clear(), copy(), pop(), popitem(),</div><div>setdefault(), update() and the fromkeys() classmethod).</div><div><br></div><div>Overall, my impression at this point is that key transformations</div><div>are useful, but I'm not sure how to incorporate them without</div><div>taking Python further away from being a language "that just fits</div><div>in your head."</div><div><br></div><div><br></div><div>Raymond</div></body></html>