Back to search

Python execution model, bytecode, and PYC files

CPython compiles source to bytecode, may cache it in `.pyc` files, and then runs that bytecode on the Python virtual machine.

Python Medium Theory

Python execution model, bytecode, and PYC files

CPython compiles source to bytecode, may cache it in `.pyc` files, and then runs that bytecode on the Python virtual machine.

  • Compilation step creates bytecode
  • Import can cache `.pyc`
  • Virtual machine executes bytecode instructions

Python execution model, bytecode, and PYC files