[Python-Dev] LinkedHashSet/LinkedHashMap equivalents

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Wed Mar 9 00:19:36 CET 2005

The perennial "how do I remove duplicates from a list" topic came up on
c.l.py and in the discussion I mentioned the java 1.5 LinkedHashSet and
LinkedHashMap. I'd thought about proposing these before, but couldn't
think of where to put them. It was pointed out that the obvious place
would be the collections module.

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?


Tim Delaney

More information about the Python-Dev mailing list