A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-March/051923.html below:

[Python-Dev] LinkedHashSet/LinkedHashMap equivalents

[Python-Dev] LinkedHashSet/LinkedHashMap equivalentsDelaney, Timothy C (Timothy) tdelaney at avaya.com
Wed Mar 9 03:40:11 CET 2005
Greg Ward wrote:

> 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. 

That's essentially the same approach I used - I didn't get around to
properly implementing a doubly-linked list between the keys - I just
maintained a list with the correct order. If I'm going to write a
Cookbook recipe though I should probably do it properly ...

Personally, I think it would be quite nice if all python dictionaries
had these semantics - it would be nice to be able to say that items will
be returned in the order they're inserted - but I wouldn't want to incur
the additional cost in such a fundamental data structure.

One thing I did notice - dict.__repr__ and dict.__str__ don't produce
strings in the iteration order of subclasses - they always use the
arbitrary dict iteration order. Is this intentional?

Tim Delaney
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4