I need an array of data that has a numeric index, but also a human readable index. I need the latter because the numeric indices may change in the future, and I need the numeric indices as a part of a fixed length socket message.
My imagination suggests something like this:
ACTIONS = {
(0, "ALIVE") : (1, 4, False),
(2, "DEAD") : (2, 1, True)
}
>ACTIONS[0]
(1, 4, False)
>ACTIONS["DEAD"]
(2, 1, True)
Use Python 2.7’s collections.OrderedDict