Python is both a compiled and interpreted language
The CPython interpreter really is an interpreter. But it also is a compiler. Python must go through a few stages before ever running the first line of code:
- scanning
- parsing
Older versions of Python added an additional stage:
- scanning
- parsing
- checking for valid assignment targets
Let’s compare this to the stages of compiling a C program:
- ~~preprocessing~~
- lexical analysis (another term for “scanning”)
- syntactic analysis (another term for “parsing”)
- ~~semantic analysis~~
- ~~linking~~