Sequenced dictionaries

Magnus Lie Hetland mlh at idi.ntnu.no
Mon Nov 5 15:07:31 CET 2001


"Morten W. Petersen" <morten at thingamy.net> wrote in message
news:Pine.LNX.4.21.0111051436400.21948-100000 at bcryachts.atsat.com...
> Hi,
>
> I'm wondering if there exists any C-based implementations of sequenced
> dictionaries, i.e. dictionaries that will remember the order of the
> objects 'added' on it.
>
> I have a pure python implementation [1] but suspect that it will be
> too slow..  Alternatively, if anyone could have a look at it and give
> some optimization tips, that would be greatly appreciated.

Just a thought... You might want to consider using a tree structure.
There you get ordering _and_ logarithmic lookup. I think there are
several implementations out there, both in Python and as C extension
modules.

> [1]
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/warp-framework/war
p_framework/zen.py?rev=1.14&content-type=text/plain
>
> -Morten

--
Magnus Lie Hetland                       The Anygui Project
http://hetland.org                       http://anygui.sf.net






More information about the Python-list mailing list