[Python-Dev] Add a "transformdict" to collections
R. David Murray
rdmurray at bitdance.com
Wed Sep 11 13:57:06 CEST 2013
On Wed, 11 Sep 2013 06:08:25 -0500, Skip Montanaro <skip at pobox.com> wrote:
> > Seriously, I'm curious: what needs to mature, according to you?
> In my mind, its availability on PyPI along with demonstrated use in
> the wild (plus corresponding votes to demonstrate that people use/like
> it) would help. That you can find several implementations at this
> doesn't mean it's necessarily worth adding to the std lib. Once in, it
> is very difficult to evict something that is later deemed not to have
> belonged in the std lib, so I think some extra scrutiny is worthwhile.
The problem is that it is hard to get traction on pypi for a "small"
feature like this. Most people will just implement a special purpose
version that solves their specific need (possibly in a somewhat broken
fashion) rather than add yet another dependency. Our approach in cases
like this has (I think) been to learn from the existing implementations
and build our own based on that (isn't that what happened with
> Is there some obvious advantage to having a single API for this
> available to all Python applications? Are the semantics well-defined
> (do all the implementations you cited offer basically the same
> semantics)? The discussion so far here suggest that the best semantics
> might not be completely settled.
I think the only question was what happens to the key on assignment,
and that has been settled. Well, I guess there's also a question of how
you create one, but that's not a question a pypi version would be any
help in resolving: we'd still bikeshed it upon addition to the stdlib.
In fact, I would not be surprised if *all* of the bikeshedding we are
doing now (except this bit :) would take place if an existing pypi module
for this were proposed for addition.
I think the bigger question is composition of different dict types,
and that is again something that isn't going to be solved by a pypi
> (I still don't care for the name. "Transform" != "case folding" in my
> mind. A quick scan of your links suggests most people think something
> like "cidict" or "CaseInsensitiveDict" would be more descriptive.)
Except it is wider than that: the transform function can be anything,
not just case folding.
I suggested surjectiondict or ontodict, but Antoine didn't like those :)
(I had to look up the terms...it's been a long time since I studied
More information about the Python-Dev