[Python-Dev] PEP 455: TransformDict

Serhiy Storchaka storchaka at gmail.com
Sat Oct 5 23:22:58 CEST 2013


06.10.13 00:08, Victor Stinner написав(ла):
> 2013/10/4 Raymond Hettinger <raymond.hettinger at gmail.com <javascript:;>>:
>  > This contrasts with other tools like OrderedDict, ChainMap,
>  > and namedtuple which started their lives outside the standard
>  > library where we we able observe their fitness for real problems
>  > being solved by real users.
>
> Why do you say that TransformDict has no real use case, whereas similar
> containers are already used since many years in the Python standard
> library? Extract of the PEP:
>
> "Several modules in the standard library use identity lookups for object
> memoization, for example pickle, json, copy, cProfile, doctest and
> _threading_local."
>
> I didn't check this whole list, but it looks like some modules can
> directly use TransformDict(id), see for example the copy module.

Unfortunately the pickle and the copy modules can't use 
TransformDict(id) because they expose their mappings (with integer id 
keys) in public API. At least until Python 4.0.

There are no so much use cases for IdentityDict in stdlib now, and even 
less for CaseInsensityDict. And a workaround is simple. I don't know 
about usage of TransformDict with other transfom function.




More information about the Python-Dev mailing list