[Python-Dev] LinkedHashSet/LinkedHashMap equivalents
Greg Ward
gward at python.net
Wed Mar 9 03:32:09 CET 2005
On 09 March 2005, Delaney, Timothy C (Timothy) said:
> For those who don't know, LinkedHashSet and LinkedHashMap are simply
> hashed sets and maps that iterate in the order that the keys were added
> to the set/map. I almost invariably use them for the above scenario -
> removing duplicates without changing order.
>
> Does anyone else think it would be worthwhile adding these to
> collections, or should I just make a cookbook entry?
+1 on a cookbook entry. +0 on adding to stdlib.
I'll attach another approach to the same problem, an ordered dictionary
object. I believe the semantics of adding/readding/deleting keys is the
same as java.util.LinkedHashMap -- certainly it seems the most sensible
and easy-to-implement semantics.
Greg
--
Greg Ward <gward at python.net> http://www.gerg.ca/
I brought my BOWLING BALL -- and some DRUGS!!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: odict.py
Type: text/x-python
Size: 2266 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20050308/8767e4c4/odict.py
More information about the Python-Dev
mailing list