Often it is useful to use a dictionary to store information where the order of that information matters. In Python, one must usually keep a list of keys and pass the list alongof that information matters. In Python, one must usually keep a list of keys and pass the list along with the dictionary to any functions that need to maintain this order.

This implementation stores the list of keys internally and overrides the usual accessor methods to keep the list up to date with each operation.

This dictionary class extends UserDict to record the order in which items are added. Calling keys(), values(), items(), etc. will return results in this order. This works similarly to the array type in PHP.


Download from: Homepage




Author:
admin
Time:
Tuesday, April 29th, 2008 at 11:36 am
Category:
Uncategorized
Comments:
You can leave a response, or trackback from your own site.
RSS:
You can follow any responses to this entry through the RSS 2.0 feed.
Navigation:

Leave a Reply