sorteddict [was a PEP proposal, but isn't anymore!]

Antoon Pardon apardon at forel.vub.ac.be
Sat Sep 29 09:49:45 EDT 2007


On 2007-09-27, gatti at dsdata.it <gatti at dsdata.it> wrote:

> Is this a practical use case? When are sequential visits of all
> elements in order frequently suspended to make insertions and
> deletions, with a need for efficient lookup by key?

Does it need to be a sequential visit of *all* elements?

Suppose you have a mapping of start times to tasks. You can then want to
iterate over all tasks that need to be started between noon en 4 pm next
monday.  If you have a hashtable you still will need to sort all the keys
even if you will visit only 10%. If you have a tree you can just visit the
specified keys.

-- 
Antoon Pardon



More information about the Python-list mailing list