[Tutor] Keeping Dictonary Entries Ordered
dorseye at gmail.com
Fri Feb 13 03:13:36 CET 2009
>>>> But you need to have an order that will work with sorted().
> Its not just the order you add items to the dict. To store an
> arbitrary order I suspect you would need to maintain a
> secondary list with the keys in the order of insertion.
> The most reliable way to dop that would be to subclass
> dict. Somebody may already have done that so its worth
> a google...
Alan, can you give a short snippet of what that would look like? I was
trying to code out some idea of how you'd retain insertion order using
another dict or a list and didn't get anywhere.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor