dis is a disassembler for bytecode. >>> def F(a, b):
... print(a * b)
...
>>> import dis
>>> dis.dis(F)
2 0 LOAD_GLOBAL 0 (print)
2 LOAD_FAST 0 (a)
4 LOAD_FAST 1 (b)
6 BINARY_MULTIPLY
8 CALL_FUNCTION 1
10 POP_TOP
12 LOAD_CONST 0 (None)
14 RETURN_VALUE
COMPILER_FLAG_NAMES is a dict whose keys seem to be the flags that can be assigned to co_flags of a code object (i. e. the __code__ attribute of a function). >>> for k,v in dis.COMPILER_FLAG_NAMES.items(): ... print(k, v) ... 1 OPTIMIZED 2 NEWLOCALS 4 VARARGS 8 VARKEYWORDS 16 NESTED 32 GENERATOR 64 NOFREE 128 COROUTINE 256 ITERABLE_COROUTINE 512 ASYNC_GENERATOR