I'm using all of them to print the names of assigned IANA values in a packet. So all of the dictionaries have the same default value "RESERVED".
I don't want to use d.get(key,default)
but access dictionaries by d[key]
so that if the key is not in d, it returns the default (that is same for all dictionaries).
I do not necessarily need to use dictionaries, but they were the intuitive choice... Also, a dictionary where I could do this
d = {
1..16 = "RESERVED",
17 : "Foo",
18 : "Bar,
19..255: "INVALID"
}
Would be the preferred solution
Tuples could be another alternative, but then I'm prone to offset errors assigning the values... (and my code would not be "human readable")
Oh yeah, Python 2.4