Python 関数を数字(数字コード)で実行する方法

def OP_NOP():
    print("This is OP_NOP, 76")

def OP_IF():
    print("This is OP_IF, 99")

def OP_NOTIF():
    print("This is OP_NOTIF, 100")

OP_CODE = {
    76: OP_NOP,
    99: OP_IF,
    100: OP_NOTIF
}

func = OP_CODE[76]
func()

$ python3 test.py
This is OP_NOP, 76

bitcoinのOPcode一覧はこちら
https://en.bitcoin.it/wiki/Script

めちゃくちゃお洒落な書き方だな~