[Python-Dev] PEP 455: TransformDict
Russell E. Owen
rowen at uw.edu
Mon Oct 7 22:01:36 CEST 2013
In article <C4C036B6-130C-4718-BEB1-A7C9230082F4 at gmail.com>,
Raymond Hettinger <raymond.hettinger at gmail.com> wrote:
> 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.
>
>...
> * Another issue is that we're accumulating too many dictionary
> variants and that is making it difficult to differentiate and choose
> between them. I haven't found anyone (even in advanced classes
> with very experienced pythonistas) would knew about
> all the variations: dict, defaultdict, Mapping, MutableMapping,
> mapping views, OrderedDict, Counter, ChainMap, andTransformDict.
I agree.
I personally think being able to transform keys would be much more
useful as a property of existing dictionaries. I often use
case-insensitive keys. But I use them with dict and OrderedDict (and
probably ought to use defaultdict, as well).
TransformDict is neat, but I'd personally be happier seeing this as a
3rd party library for now.
-- Russell
More information about the Python-Dev
mailing list