New submission from Antoine Pitrou:

This is a very common need when implementing network protocols. You want to 
match keys case-insensitively but also preserve the original casing (e.g. for 
presentation).

When searching on the Web, you see many people reimplementing their own variant 
(often incomplete, or buggy). For example, Twisted has its own, the email 
package has something resembling it, WebOb also.

Having an implementation in the stdlib would spare many people the effort, 
ensure the implementation is complete and well-tested, and perhaps also add 
some optimizations to mitigate the overhead compared to a plain dict.

Note this is an instance of a more general pattern, where they key used for 
matching is derived from the lookup key using a constant derivation function. 
So maybe we want to implement the more general pattern and let users specify 
str.lower as the key derivation function.

----------
components: Library (Lib)
messages: 197359
nosy: barry, pitrou, r.david.murray, rhettinger, tim.peters
priority: normal
severity: normal
status: open
title: Add a case-insensitive case-preserving dict
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18986>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to