cascade
Cascade get value from dictionary in Python
Several times I've been faced with the problem: Get a value from a dictionary. If the key is not present, then get from another key. Normally, the implementation would go like this: if dict.has_key(key1): return dict[key1] elif dict.has_key(key2): return dict[key2]