multi dimensional dictionary

Hrvoje Niksic hniksic at xemacs.org
Wed May 28 03:30:27 EDT 2008


Gary Herron <gherron at islandtraining.com> writes:

> mydict[(0,"person","setTime")] = "12:09:30"
> mydict[(0,"person","clrTime")] = "22:09:30"

Note that this is more succinctly written as:

    mydict[0, "person", "setTime"] = "12:09:30"

with the added advantage that it looks like a multi-dimensional array.
:-)

The only problem with this approach is that when you want to iterate
over, say, mydict[0], or mydict[0]["person"], it's not possible
without traversing the entire dict.



More information about the Python-list mailing list