How Python Runs Programs

Process: source code -> compiled byte code -> PVM (Python Virtual Machine) runs byte code
Performance loss: compilation + extra work in running virtual machine
Implementation variations: CPython (the standard); Jython; IronPython; Stackless Python; PyPy (with JIT compiler).
Optimization: Cython (Python/C hybrid)
Frozen binary: PyInstaller

Python Conceptual Hierarchy

programs > modules > statements > expressions > objects

Core Data Types

  • Number (int, float, complex, decimal, fraction, boolean)
  • String
  • List
  • Dictionary
  • Tuple
  • File
  • Set
  • None
  • Program units: function, module, class


Variable is created during value assignment. Variable itself has no type information, it simply points to an object and the object can be any type. Python's typing is:

  • Dynamic: type is determined automatically at runtime, not declared
  • Strong: every object has two header fields: type designator; reference counter.

Objects are garbage-collected, programmer doesn't have to free them.