Python에서 switch case문을 대치할 방법을 찾다가 알게 된 내용, 예전에 쓰던 함수 포인터와 같다.
def function_1():
print("function_1")
def function_2():
print("function_2")
def function_3():
print("function_3")
functions = {1: function_1,
2: function_2,
3: function_3}
try:
func = functions[4]
func()
except KeyError as ex:
print(ex)