From: jeffp at crusoe.net (evil Japh)
Date: Fri, 9 Apr 1999 18:30:04 -0400
Subject: OrderedDict.py
Message-ID: <Pine.GSO.3.96.990409180912.20801E-100000@crusoe.crusoe.net>
X-UID: 771                                                  

Is there a need for a module which allows for ordered processing of an
dictionary?

I have one written, and it works fine I think.  Basically, it allows for a
dictionary to be treated like a list, but have the data structure of
dictionary.  Key-value pairs retain the order you entered them in.  Unless
you specifically change them.  I'm currently working on more methods, to
allow it to be sliced like an array.

currently, it wouldn't allow for numeric keys, because the __getitem__
finds out what you sent, an integer (numeric index) or a string (a
dictionary key).  the __getslice__ and __setslice__ aren't a problem.  I
could make a special class for indices for getting dict[4]...

something like:

dict[Index(4)] instead of dict[4]

but I'd like to be as seamless as possible.

I'll be putting the code on my web site soon.

-- 
Jeff Pinyan (jeffp at crusoe.net)
www.crusoe.net/~jeffp

Crusoe Communications, Inc.
732-728-9800
www.crusoe.net





