Before execution, what does CPython compile source code into?
Compiles it to bytecode, which its interpreter then runs.
- Runs each text line directly
- Compiles it straight to machine code
- Compiles it to bytecode ✔
Why: CPython compiles source code into bytecode, an internal set of instructions. Its virtual machine executes that bytecode. Cached .pyc files can let later executions skip recompilation when the source is unchanged.
Huh, didn't know that: Python's documentation calls bytecode the internal representation of a Python program in CPython.
Why did the Python file feel faster the second time? It already had its .pyc ready.
References
Answer: Compiles it to bytecode. CPython compiles source code into bytecode, an internal set of instructions. Its virtual machine executes that bytecode. Cached .pyc files can let later executions skip recompilation when the source is unchanged.
- Python docs: Glossary (bytecode) docs.python.org/3/glossary.html
Python source code is compiled into bytecode, the internal representation of a Python program in the CPython interpreter.
Checked 2026-10-10.
Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.
More stuff everyone should know
That's stuff everyone should know.