[New-bugs-announce] [issue18986] Add a case-insensitive case-preserving dict

Antoine Pitrou report at bugs.python.org
Mon Sep 9 13:22:01 CEST 2013


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 <report at bugs.python.org>
<http://bugs.python.org/issue18986>
_______________________________________


More information about the New-bugs-announce mailing list