Python Bytecode
CPython compiles source to bytecode instructions that its virtual machine executes; dis shows them.
Advanced
import dis
def add(a, b): return a + b
dis.dis(add) # LOAD_FAST a, LOAD_FAST b, BINARY_OP +, RETURN_VALUE
Bytecode is cached in __pycache__/*.pyc files. It's an implementation detail and changes between versions.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.