Compilers and interpreters

There are generally two types of languages:

  • Compiled languages
  • Interpreted languages

Compiled languages use a compiler to compile the source code into a binary executable, like an exe file. That file can then be run on the operating system without dependencies. Interpreted languages take the source code and run it line by line, no compilation step is needed, but an interpreter is needed anytime you want to run the code.

Python is an interpreted language, meaning that it needs an interpreter to run it.

Pros of compiled languages

  • Faster
  • Smaller final size
  • Fewer dependencies
  • Optimizations: Compilers can apply more optimizations

Cons of compiled languages

  • Compilation can take long

Pros of interpreted languages

  • Runs anywhere the interpreter is supported

Cons of interpreted languages

  • Slower, on average, than compiled languages
  • Need to also have an interpreter to run