[Python-Dev] LinkedHashSet/LinkedHashMap equivalents
Eli Stevens (WG.c)
listsub at wickedgrey.com
Thu Mar 10 01:17:49 CET 2005
Steven Bethard wrote:
> Thomas Heller <theller at python.net> wrote:
>>[About an ordered dictionary]
> Well, that was basically the question I posed. So far I've seen only
> one use for it, and that one is better served by adding a function to
> itertools. What use do you have for it other than filtering
> duplicates from a list while retaining order?
The primary use case I have deals with DB result sets*. The ordering of
the rows returned from a query is important, so keeping the iteration
order is nice. Most of the tables I deal with have keys of some kind,
and being able to pull out a result row by key is also nice. Granted, I
rarely use /both/ at the same time, but it is nice to not have to
specify how the result set will be used when I retrieve it.
To me, this seems to be the same concept as the config file parsing
I don't feel qualified to have an opinion** about inclusion in the
stdlib, much less vote.
[*] - In my case, it's actually coded in Java, for work. There might be
a reason that this problem isn't language-generic, but the 1.5 minutes I
spent thinking about it were not illuminating.
[**] - Yet I have one anyway. This kind of datatype seems one of those
easy-to-get-half-right things that could benefit from a solid
implementation. It also doesn't strike me as controversial in terms of
API or internal structure.
More information about the Python-Dev