[Python-Dev] PEP 455: TransformDict

Antoine Pitrou solipsis at pitrou.net
Fri Sep 13 22:22:51 CEST 2013

On Fri, 13 Sep 2013 16:09:10 -0400
"R. David Murray" <rdmurray at bitdance.com> wrote:
> On Fri, 13 Sep 2013 20:40:58 +0200, Antoine Pitrou <solipsis at pitrou.net> wrote:
> > Rationale
> > =========
> > 
> > Numerous specialized versions of this pattern exist.  The most common
> > is a case-insensitive case-preserving dict, i.e. a dict-like container
> > which matches keys in a case-insensitive fashion but retains the
> > original casing.  It is a very common need in network programming, as
> > many protocols feature some arrays of "key / value" properties in their
> > messages, where the keys are textual strings whose casing isn't
> > relevant.
> This motivation would be stronger if the last phrase was something like
> "where the keys are textual strings whose case is specified to be ignored
> on receipt but by either specification or custom is to be preserved
> or non-trivially canonicalized when retransmitted."

Thanks, will add.

> > (it can be said that the pattern *projects* keys from the user-visible
> > set onto the internal lookup set, hence this PEP's title)
> Not clear what "projects" has to do with the PEP title.

The PEP was originally titled "a key-projecting dictionary" and I've
changed it as it was too obscure.  I've now also removed the obsolete
part of the sentence above :-)

> > Alternative proposals and questions
> > ===================================
> You don't mention the alternate constructor discussion, or the
> rationale for following the defaultdict pattern (ie: following the
> established pattern :)

Ok, will do that too.



More information about the Python-Dev mailing list