Part 1 of 6 · Chapter 1 of 4

Why Python, Specifically

Every language claims to be simple, right up until you try to read one. Look at a working Python program you have never seen before, and notice how much of it you already understand.

Beginner7 min read

You have not written a line of Python yet, and the next block of code is a real, working program. Read it before you read the explanation below it — you will understand more of it than you expect.

A language you can read before you can write it

grades.py
scores = [78, 92, 65, 88]total = sum(scores)average = total / len(scores) if average >= 90:    print("Grade: A")elif average >= 80:    print("Grade: B")else:    print("Grade: C")

A list of four numbers, a total, an average, and a decision based on it. Nothing in that program is disguised. sum adds the list up. len counts it. The indentation is not decoration — it is how Python marks which lines belong to which decision, instead of wrapping them in curly braces the way many other languages do.

That readability is not an accident. Python was designed, from its first release in 1991, around the idea that code is read far more often than it is written, and that a language should optimise for the reader.

What it is actually running underneath

When you run a Python file, nothing translates it directly into the ones and zeros your processor understands. The standard implementation, CPython, compiles your file into an intermediate form called bytecode, then an interpreter reads that bytecode one instruction at a time and carries it out.

That extra step is what makes Python interpreted rather than compiled in the sense C or Rust are. You never wait for a separate build step — you run the file and it goes — but every instruction is costing you a layer of translation that a compiled language paid for once, in advance.

Where speed gets traded for your time back

That translation layer has a real cost. A tight numeric loop written in raw Python can run tens of times slower than the same loop written in C. For a program that spends its life adding up sixty numbers, you would never notice. For a program processing billions of numbers, you would.

In practice, most Python code that needs to be fast is not slow, because it calls into libraries — for data, for machine learning, for anything numeric — that are themselves written in C underneath and only driven by Python. You get the reading and writing speed of Python and the execution speed of C, for the parts that actually run millions of times.

Key takeaways

  • Python is designed to be read, not just written — indentation marks structure instead of braces.
  • CPython compiles your file to bytecode, then interprets it one instruction at a time.
  • That interpretation step is why raw Python loops run slower than raw C loops.
  • Most fast Python code works by calling into C libraries underneath, not by Python itself being fast.
  • Do not optimise for speed before you have a program. Solve the problem first.