On Tue, 10 Sep 2013 16:21:18 +0100, Nigel Small <nigel at nigelsmall.com> wrote: > Could a more generic variant of this class work? In the same way that > `sorted` can accept a comparison function, similar could be done for a > dictionary-like class: > > d = transformdict(key=str.lower) > > Strictly speaking, this would provide case-insensitive but not > case-preserving behaviour. For any given use case, though, a function could > instead be supplied to "normalise" the key (upper, lower, title case, etc) > in a way that fits that case. I can't think of many real cases where > multiple types of capitalisation would be useful within the same dictionary. I can: MIME-Version Message-ID Content-Type For network protocols you really do want to *preserve* the case. --David
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4