[issue18986] Add a case-insensitive case-preserving dict

2015-05-16 Thread Ethan Furman
Ethan Furman added the comment: >From https://mail.python.org/pipermail/python-dev/2015-May/140003.html == Before the Python 3.5 feature freeze, I should step-up and formally reject PEP 455 for "Adding a key-transforming dictiona

[issue18986] Add a case-insensitive case-preserving dict

2015-05-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- status: open -> pending ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue18986] Add a case-insensitive case-preserving dict

2015-02-28 Thread Jason R. Coombs
Jason R. Coombs added the comment: I'm also eager to hear what limitations prevented the acceptance. Please do link back here when you've posted. I have to say, I'm not entirely surprised. In my implementation, I struggled with some cases, and it certainly doesn't feel like a fully safe implem

[issue18986] Add a case-insensitive case-preserving dict

2015-02-18 Thread Demian Brecht
Demian Brecht added the comment: > I will be interested to see those reasons. +1. Something like what this PEP proposed would be beneficial in a few places throughout the library (header and cookie implementations would definitely benefit rather than having to deal with buggy normalization the

[issue18986] Add a case-insensitive case-preserving dict

2015-02-17 Thread Martin Panter
Martin Panter added the comment: I will be interested to see those reasons. Another way to do a similar thing might be using a Key(value, transform) class, somewhat along the lines of Issue 20632, but as a separate class rather than part of the core type system. But I have not thought that ide

[issue18986] Add a case-insensitive case-preserving dict

2015-02-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: FYI, the PEP for this isn't going to be accepted (I'm working on the write-up for the reasons why and will post on python-dev). That said, it would be great if the code continues to be improved and then posted on the Python Package Index. -- ___

[issue18986] Add a case-insensitive case-preserving dict

2015-02-16 Thread Demian Brecht
Demian Brecht added the comment: Some refactoring that I'm working on for http.client could use this (currently I have it as part of my patch set). I haven't run into any issues using it and it's definitely useful. Would be nice to get this merged. -- nosy: +demian.brecht

[issue18986] Add a case-insensitive case-preserving dict

2015-01-15 Thread STINNER Victor
STINNER Victor added the comment: The API is simple and well defined, the addition is small, I don't understand what is the problem with this enhancement. -- ___ Python tracker

[issue18986] Add a case-insensitive case-preserving dict

2015-01-15 Thread Martin Panter
Martin Panter added the comment: For the record, this is related to PEP 455 (key-transforming dictionary) -- nosy: +vadmium ___ Python tracker ___ ___

[issue18986] Add a case-insensitive case-preserving dict

2015-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: Yes. I intend to button this one up before long. -- ___ Python tracker ___ ___ Python-bugs-list

[issue18986] Add a case-insensitive case-preserving dict

2015-01-14 Thread Ethan Furman
Ethan Furman added the comment: 3.5 is almost here; Raymond, care to make a ruling? -- ___ Python tracker ___ ___ Python-bugs-list mai

[issue18986] Add a case-insensitive case-preserving dict

2013-12-14 Thread Mark Dickinson
Mark Dickinson added the comment: Not my applications, no. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue18986] Add a case-insensitive case-preserving dict

2013-12-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: [Mark Dickinson] > It's essentially an IdentityDict, though I've found other > more specific transforms useful. Have any of the applications had use for the part of the API that looks up the original, untransformed key? --

[issue18986] Add a case-insensitive case-preserving dict

2013-12-13 Thread Eli Bendersky
Changes by Eli Bendersky : -- nosy: -eli.bendersky ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue18986] Add a case-insensitive case-preserving dict

2013-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: > Mark, what was the use case you found? It's essentially an IdentityDict, though I've found other more specific transforms useful. I was writing a tool to find reference cycles between Python objects (we have a customer application that's working in a multit

[issue18986] Add a case-insensitive case-preserving dict

2013-12-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Mark, what was the use case you found? -- versions: +Python 3.5 -Python 3.4 ___ Python tracker ___ __

[issue18986] Add a case-insensitive case-preserving dict

2013-12-12 Thread Mark Dickinson
Mark Dickinson added the comment: +1 for this (for Python 3.5, now, I guess). I've just found another place where I'd use it. Looking at the implementation, one thing surprises me a bit: I'd expect the KeyError from a 'del' or 'pop' operation to have the untransformed key rather than the tra

[issue18986] Add a case-insensitive case-preserving dict

2013-10-13 Thread Mark Dickinson
Changes by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue18986] Add a case-insensitive case-preserving dict

2013-10-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Antoine, is the PEP ready for review? Well, I think it is. Do you think other points should be addressed in it? We still have some time. -- ___ Python tracker __

[issue18986] Add a case-insensitive case-preserving dict

2013-10-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Antoine, is the PEP ready for review? -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue18986] Add a case-insensitive case-preserving dict

2013-10-04 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue18986] Add a case-insensitive case-preserving dict

2013-10-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: Raymond, have you had time to look at this? -- ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue18986] Add a case-insensitive case-preserving dict

2013-09-22 Thread Jason R. Coombs
Jason R. Coombs added the comment: I just want to say thanks for working on this. I also have needed this functionality for various needs in the past. To fulfill my needs, I wrote this implementation: https://bitbucket.org/jaraco/jaraco.util/src/1ab3e7061f96bc5e179b6b2c46b06d1c20f87129/jaraco/

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Eric V. Smith
Eric V. Smith added the comment: On 09/17/2013 10:12 AM, Eric V. Smith wrote: > On the other hand, I don't have a use case for the original key, anyway. > So I don't have a strong feeling about this, other than it feels odd > that the answer to the original question (I think on python-dev) "how d

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Oh, could anyone borrow Guido's time machine and rename either __getitem__() to __getvalue__() or items() to entries()? -- ___ Python tracker ___

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Eric V. Smith
Eric V. Smith added the comment: On 09/17/2013 09:34 AM, R. David Murray wrote: > > R. David Murray added the comment: > > Because most often the time at which you want the original key is the point > at which you are about to re-serialize the data...so you need the value too. I can't think o

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread R. David Murray
R. David Murray added the comment: I do think getitem is the most natural name for the method. -- ___ Python tracker ___ ___ Python-bu

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread R. David Murray
R. David Murray added the comment: Because most often the time at which you want the original key is the point at which you are about to re-serialize the data...so you need the value too. -- ___ Python tracker ___

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry, I don't understand why it's more useful. We need create a tuple and then index it or unpack it and drop one of elements. This only muddles away a time and programmer's attention. -- ___ Python tracker

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: > But why not getkey()? Why you need return value too? Because it's more useful to return both. -- ___ Python tracker ___ _

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: But why not getkey()? Why you need return value too? -- ___ Python tracker ___ ___ Python-bugs-lis

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Georg Brandl
Georg Brandl added the comment: Hmm, I didn't consider popitem(). Maybe I'm too paranoid about users confusing __getitem__() and getitem() after all :) -- ___ Python tracker __

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Georg Brandl added the comment: > > Not really. Would "entry" be acceptable instead of "item"? getentry() sounds decent to me, but it loses the parallel to popitem() and items(). -- ___ Python tracker

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Georg Brandl
Georg Brandl added the comment: Not really. Would "entry" be acceptable instead of "item"? -- ___ Python tracker ___ ___ Python-bugs-l

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Georg Brandl added the comment: > > Note that I'm strongly against this name of the getitem() method. Any suggestion? -- ___ Python tracker

[issue18986] Add a case-insensitive case-preserving dict

2013-09-17 Thread Georg Brandl
Georg Brandl added the comment: Note that I'm strongly against this name of the getitem() method. -- nosy: +georg.brandl ___ Python tracker ___ __

[issue18986] Add a case-insensitive case-preserving dict

2013-09-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Uploading new patch with added transform_func property. -- Added file: http://bugs.python.org/file31761/transformdict3.patch ___ Python tracker

[issue18986] Add a case-insensitive case-preserving dict

2013-09-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Updated patch adding the getitem() method. -- Added file: http://bugs.python.org/file31757/transformdict2.patch ___ Python tracker ___ _

[issue18986] Add a case-insensitive case-preserving dict

2013-09-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Note: I haven't renamed transformdict to TransformDict yet. -- ___ Python tracker ___ ___ Python-bug

[issue18986] Add a case-insensitive case-preserving dict

2013-09-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Did you try any other microbenchmarks? Your approach sounds promising. Any microbenchmarks which I tried did not show any interesting. Until I found the cause of slowing down ComplexPythonFunctionCalls I have no idea which tests can be representable. Of c

[issue18986] Add a case-insensitive case-preserving dict

2013-09-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: > > Does it slow down regular dicts? > > I were surprized, but yes. The ComplexPythonFunctionCalls test from > pybench is 40% slower with ctransformdict.patch (and I still don't > known why). With dict__transform__.patch it is only 2% slower. All > other pybench

[issue18986] Add a case-insensitive case-preserving dict

2013-09-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Does it slow down regular dicts? I were surprized, but yes. The ComplexPythonFunctionCalls test from pybench is 40% slower with ctransformdict.patch (and I still don't known why). With dict__transform__.patch it is only 2% slower. All other pybench tests a

[issue18986] Add a case-insensitive case-preserving dict

2013-09-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is an alternative C implementation. It adds to the dict class support of the __transform__() method. If this method is defined in dict subclass it used to transforming keys. collections.TransformDict is just utilizes this feature as collections.defaultd

[issue18986] Add a case-insensitive case-preserving dict

2013-09-12 Thread Ethan Furman
Ethan Furman added the comment: Right, sorry. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue18986] Add a case-insensitive case-preserving dict

2013-09-12 Thread R. David Murray
R. David Murray added the comment: You are conceptualizing this very differently. In our view, this data structure is for cases where the original key is the most important piece of information (about the keys). The transformation in the lookup process is entirely in the service of looking u

[issue18986] Add a case-insensitive case-preserving dict

2013-09-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ethan, please don't post the same message *both* on the tracker and on the mailing-list. I'm sure most people here also read the ML thread. -- ___ Python tracker __

[issue18986] Add a case-insensitive case-preserving dict

2013-09-12 Thread R. David Murray
R. David Murray added the comment: It would be simpler, but it would also be useless for the actual use case for which this issue was opened. -- ___ Python tracker ___ _

[issue18986] Add a case-insensitive case-preserving dict

2013-09-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: > R. David Murray added the comment: > > You are conceptualizing this very differently. In our view, this > data structure is for cases where the original key is the most > important piece of information (about the keys). The transformation > in the lookup pro

[issue18986] Add a case-insensitive case-preserving dict

2013-09-12 Thread Ethan Furman
Ethan Furman added the comment: True, but how big a deal is that? For one, it seems questionable to have the presentation portion of the data be part of the key. For two, when presentation is important a separate list must be kept anyway to preseed the dict; so just use that list to cycle thr

[issue18986] Add a case-insensitive case-preserving dict

2013-09-12 Thread Ethan Furman
Ethan Furman added the comment: On 09/11/2013 02:39 PM, Tim Delaney wrote on PyDev: > > I would think that retrieving the keys from the dict would return the > transformed keys (I'd > call them canonical keys). The more I think about this the more I agree. A canonicaldict with a key functio

[issue18986] Add a case-insensitive case-preserving dict

2013-09-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: Serhiy, any benchmarks for your implementation? Does it slow down regular dicts? -- ___ Python tracker ___ _

[issue18986] Add a case-insensitive case-preserving dict

2013-09-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : Added file: http://bugs.python.org/file31729/ctransformdict.patch ___ Python tracker ___ ___ Python-bugs-list ma

[issue18986] Add a case-insensitive case-preserving dict

2013-09-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : Removed file: http://bugs.python.org/file31728/ctransformdict.patch ___ Python tracker ___ ___ Python-bugs-list

[issue18986] Add a case-insensitive case-preserving dict

2013-09-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a preliminary C implementation. -- Added file: http://bugs.python.org/file31728/ctransformdict.patch ___ Python tracker ___ __

[issue18986] Add a case-insensitive case-preserving dict

2013-09-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: I would *really* like for this to start outside the standard library. It needs to mature with user feedback before being dumped in the collections module (which was never intended to be a giant pile of every collection a person could think of). Adding yet m

[issue18986] Add a case-insensitive case-preserving dict

2013-09-10 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue18986] Add a case-insensitive case-preserving dict

2013-09-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: Updated patch: fixes repr(), and retains the first key not the last. -- Added file: http://bugs.python.org/file31727/transformdict.patch ___ Python tracker

[issue18986] Add a case-insensitive case-preserving dict

2013-09-10 Thread Éric Araujo
Éric Araujo added the comment: FTR this is one message from the previous thread about this: https://mail.python.org/pipermail/python-ideas/2010-June/007332.html -- nosy: +eric.araujo ___ Python tracker ___

[issue18986] Add a case-insensitive case-preserving dict

2013-09-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: > With the current patch __repr__() will fail if the untransformed key > is unhashable: Yeah, the __repr__() implementation will be a bit annoying to get right :-) -- ___ Python tracker

[issue18986] Add a case-insensitive case-preserving dict

2013-09-10 Thread Richard Oudkerk
Richard Oudkerk added the comment: With the current patch __repr__() will fail if the untransformed key is unhashable: >>> d = collections.transformdict(id) >>> L = [1,2,3] >>> d[L] = None >>> d.keys() Traceback (most recent call last): File "", line 1, in File "C:\Repos\cpython-dirty\lib

[issue18986] Add a case-insensitive case-preserving dict

2013-09-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm uploading a pure Python transformdict implementation + tests, for Serhiy's benefits (and others') :-) -- keywords: +patch Added file: http://bugs.python.org/file31713/transform.patch ___ Python tracker

[issue18986] Add a case-insensitive case-preserving dict

2013-09-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: (now relayed on python-dev) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > It will be good if your provide complete test suite. ... Again, take a look at the code I've posted above ... -- ___ Python tracker ___ _

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > It of course will make a size of source file bigger, but shouldn't > affect a size or performance of normal dicts. A dict object contains > dk_lookup. You need to keep both the original keys and the transformed keys. It's not only about transforming keys on l

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > I'm curious to know how you'll integrate it in dictobject.c without slowing > down normal dict objects, and without making them bigger. It of course will make a size of source file bigger, but shouldn't affect a size or performance of normal dicts. A dict

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > By patching Objects/dictobject.c of course. Am I stupid :-) > I suppose it should require changing about 400 lines of code, a little > more than for IdentityDict. When you provides the specification > perhaps I will provide a patch. Well, take a look at the

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Why? Many custom dict-like classes aren't. And this is weird (issue10977). > Can you explain how? By patching Objects/dictobject.c of course. I suppose it should require changing about 400 lines of code, a little more than for IdentityDict. When you prov

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Proposed names: custom_dict, KeyedDictionary, Dictionary. Sounds much too vague and un-specific. > It will be confused if this dict will not be compatible with PyDict > API. Why? Many custom dict-like classes aren't. > It is possible to add such feature dir

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I also note that defaultdict is implemented via a special method on > dict itself (__missing__), and if this one was implemented the same > way it would be easy to combine the features. It's not that simple: to remember the original casing you need either a se

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: (as a sidenote, you might want a case-insensitive OrderedDict as well, I see no reason to make a special case for defaultdict here) -- ___ Python tracker _

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Ethan Furman
Ethan Furman added the comment: Precisely what I was thinking. :) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread R. David Murray
R. David Murray added the comment: Indeed. Although there was apparently some call for it, it doesn't sound from a quick google like defaultdict was deemed to require a PEP. Presumably the informed audience should be wider than this issue, though. I also note that defaultdict is implemented

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also discussion on a topic: http://comments.gmane.org/gmane.comp.python.ideas/18469 . Proposed names: custom_dict, KeyedDictionary, Dictionary. It will be confused if this dict will not be compatible with PyDict API. It is possible to add such feature d

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > +10 to make this a PEP so that more people have a chance to express > their opinion (currently only those who noticed it on the issues > mailing list). I find the issue tracker a very bad medium for any kind > of brain-storming or bikeshedding. Well, I don't t

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > FYI os.environ uses something similar: keys and values are encoded and > decoded using functions. So any transformation is supported. I don't think this is the same situation. os.environ has bijective transformations, which don't pose any implementation challe

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread STINNER Victor
STINNER Victor added the comment: FYI os.environ uses something similar: keys and values are encoded and decoded using functions. So any transformation is supported. http://hg.python.org/cpython/file/eac63e7ceb03/Lib/os.py#l636 On UNIX, the encoder and decoder are os.fsencode() and os.fsdecode

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Eli Bendersky
Eli Bendersky added the comment: +1 For the general idea +1 For the more generic approach of which "lowercase" is just one special case +10 to make this a PEP so that more people have a chance to express their opinion (currently only those who noticed it on the issues mailing list). I find the

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: I would like to shorten the proposals to "transformdict" and "coercedict". (after all, transforming the values would have little sense: you can do it yourself trivially) -- ___ Python tracker

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread R. David Murray
R. David Murray added the comment: coercekeydict -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Matthew Barnett
Matthew Barnett added the comment: mappeddict? Re defaultdict, you could write a dict that does all of these things, called superdict! :-) -- ___ Python tracker ___ ___

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Ethan Furman
Ethan Furman added the comment: To the point, however, Eric's example would make use of both the defaultdict portion and the transformkey portion in a single dict. -- ___ Python tracker ___

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > It would be nice to combine the behaviors that defaultdict and the > case-insensitive comparisons. Any use case? In my experience they are used in completely different situations. defaultdict mostly to use the writing of some (internal) algorithms, a case-ins

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Eric V. Smith
Eric V. Smith added the comment: True enough! I was trying to distinguish keys that I populate with initial values (mostly stock indexes) versus those where I just read values from a user-supplied file. When I populate the index values, I'd like to preserve the case I initially used. When I u

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > In this case I just str.upper everything, but it would be a nice > feature to case-preserve the keys that I pre-populate. I care less > about the keys from user data. Well, stock symbols are what I would call user data :-) --

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Eric V. Smith
Eric V. Smith added the comment: Just today I was using a defaultdict where the keys are stock symbols. They're case insensitive (at least for this particular application). In this case I just str.upper everything, but it would be a nice feature to case-preserve the keys that I pre-populate. I

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Eric V. Smith
Eric V. Smith added the comment: It would be nice to combine the behaviors that defaultdict and the case-insensitive comparisons. -- nosy: +eric.smith ___ Python tracker ___ ___

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Ethan Furman
Ethan Furman added the comment: I would say - transformkeydict Too bad we can't just add an extra 'transform_key' keyword to defaultdict. -- ___ Python tracker ___ ___

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, let's bikeshed this a bit. What should be the name? - projectdict? - normalizedict? - normdict? - derivedict? - transformdict? - any ideas? -- ___ Python tracker __

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread R. David Murray
R. David Murray added the comment: For the record, email is not a good argument for this, since email could not use this data structure (its data structure is *not* a dict, but a list with dict-like features grafted on). I do think this would be useful, and the generic version (analogous to d

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: For the record, I have my own implementation here: https://bitbucket.org/optiflowsrd/obelus/src/tip/obelus/casedict.py?at=default https://bitbucket.org/optiflowsrd/obelus/src/tip/obelus/test/test_casedict.py?at=default -- ___

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Surely a case-insensitive dict should use str.casefold, not > str.lower? Perhaps. Network protocols will usually only allow ASCII in parts where case is insensitive (e.g. header names), so it shouldn't make a difference. Implementing the generic pattern means

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Matthew Barnett
Matthew Barnett added the comment: Surely a case-insensitive dict should use str.casefold, not str.lower? -- nosy: +mrabarnett ___ Python tracker ___

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Thomas Heller
Changes by Thomas Heller : -- nosy: +theller ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue18986] Add a case-insensitive case-preserving dict

2013-09-09 Thread Antoine Pitrou
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 i