Re: [Python-Dev] Add a transformdict to collections

2013-09-10 Thread Nigel Small
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

Re: [Python-Dev] PEP 455: TransformDict

2013-10-30 Thread Nigel Small
It strikes me that there could be an alternative approach to some of the use cases discussed here. Instead of a new type of dictionary, the case-insensitivity problem could be solved with something akin to a * CaseInsensitiveString* class used for keys within a standard dictionary. This would be

Re: [Python-Dev] PEP 455: TransformDict

2013-10-30 Thread Nigel Small
in a similar way, I'm simply trying to raise the question of where the genericity could sit: in the dictionary or in the key. Nigel On 30 October 2013 17:04, Ethan Furman et...@stoneleaf.us wrote: On 10/30/2013 09:34 AM, Nigel Small wrote: It strikes me that there could be an alternative approach