[Python-Dev] LinkedHashSet/LinkedHashMap equivalents
tommy at ilm.com
Thu Mar 10 01:39:42 CET 2005
I'd say I'm +0. fwiw- I've been using a locally-rolled OrderedDict
implementation for the last 5-6 years in which insertion order is the
only order respected. I use it all over the place (in a code base of
~60k lines of python code).
so there's another use case for you. bust as you say, easy to do
| Thomas Heller wrote:
| > I cannot understand why people are against adding it to stdlib (after
| > the name, the implementation, and the exact place have been decided).
| > It's certainly a useful data type, isn't it?
| It depends on the precise semantics. You often want a dictionary where
| the keys come out in some order - but that is rarely the order in which
| they were added to the dictionary. Most frequently, you want the keys
| sorted, according to some criteria. If not that, I would assume that you
| typically have the order of keys determined before even filling the
| dictionary, in which case you can do
| for k in keys_in_preferred_order:
| v = hashtable[k]
| I remember having needed that once in the past 15 years (in Smalltalk
| at the time), so I wrote an OrderedDictionary for Smalltalk/V (which
| didn't have it). It took me an hour or so.
| I don't recall what precisely it was that I needed it for, and I cannot
| think of any use case for the data type right now.
| So I'm -0 on adding the data type: I have a vague feeling it is needed,
| but rarely, and I don't know precisely what for.
| Python-Dev mailing list
| Python-Dev at python.org
| Unsubscribe: http://mail.python.org/mailman/options/python-dev/tommy%40ilm.com
More information about the Python-Dev