[Python-Dev] PEP 455: TransformDict

Georg Brandl g.brandl at gmx.net
Sat Sep 14 07:24:27 CEST 2013


On 09/13/2013 10:09 PM, R. David Murray 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."
> 
>> (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.

Clearly it should be called ProjectionDict!

cheers,
Georg




More information about the Python-Dev mailing list