A Bit about Bytes: Understanding Python Bytecode
summary
Explains what lives in .pyc files (the co_consts, co_varnames, co_code fields), shows how to map raw bytes to opname entries like load_fast and how dis.dis prints human‑readable bytecode, demonstrates Python 3.6’s two‑byte instruction layout and even‑offsets, and gives concrete examples: using dis to find the exact instruction that raised an exception, and observing constant folding where literal arithmetic is evaluated at compile time so the runtime becomes a simple return.
AI-written summary · about
chapters (14)
- 0:00Start
- 0:37Why Are We Here at Pycon
- 0:50Why Do We Love Python
- 5:52Python Bytecode
- 8:28Bytecode
- 14:33Evaluation Stack
- 14:53Block Stack
- 17:44Python Standard Library Documentation
- 19:53Stack Oriented Programming
- 23:05Specter
- 25:13Not all Bytecode Instructions Are Equally Expensive To Execute
- 25:26Micro Optimization
- 26:17General Guidelines
- 28:36Python Interpreter in Python








