Theory Flashcards
Bytecode
Python source code is compiled into bytecode, the internal representation of a Python program in the CPython interpreter. Bytecode is also cached in .pyc files. Bytecode runs on a virtual machine
Class Definition Scope
Python creates a temporary namespace for the class to store class-level variables
unbound local variables are looked up in the global namespace
GIL
Global Interpreter Lock
mutex that allows only one thread to hold the control of the interpreter
only in CPython
Garbage Collection
Reference Counting
tracking references
deallocating memory
Generational Garbage Collection
- generation 0 (youngest)
- generation 1 (middle-aged)
- generation 2 (oldest)
prioritizing younger objects
handling cyclic references