Sequenced dictionaries
Magnus Lie Hetland
mlh at idi.ntnu.no
Mon Nov 5 09:05:51 EST 2001
More information about the Python-list mailing list
Mon Nov 5 09:05:51 EST 2001
- Previous message (by thread): Sequenced dictionaries
- Next message (by thread): Sequenced dictionaries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"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. Well... You might want to keep around a dictionary (redundantly) for quicker lookups, possibly a separate dictionary for sequence number or something. And you probably ought to use lists (and change them with del, insert, and the like) instead of creating new tuples all the time. I think quite a lot of speedup can be gained by modifying your Python code. > [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
- Previous message (by thread): Sequenced dictionaries
- Next message (by thread): Sequenced dictionaries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list