On Tue, 10 Sep 2013 16:21:18 +0100, Nigel Small <ni...@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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com