<s>[INST] Replacements for switch statement in Python? I want to write a function in Python that returns different fixed values based on the value of an input index.  
In other languages I would use a switch or case statement, but Python does not appear to have a switch statement.  What are the recommended Python solutions in this scenario?
 [/INST] If you'd like defaults you could use the dictionary get(key[, default]) method:
def f(x):
    return {
        'a': 1,
        'b': 2,
    }.get(x, 9)    # 9 is default if x not found

 </s>