Python is the language people reach for when the problem matters more than the plumbing. This post explains what it actually is, what makes it different from the languages it is usually compared to, and where its weak spots are.
A language and an interpreter
"Python" names two things, and it helps to keep them apart.
The language is the syntax and the rules — what a for loop looks
like, what happens when you add a string to a number. The interpreter is the program
called python3 that reads your file and does what it says. The usual one is CPython,
written in C, and it is what you installed.
There is no separate compile step you run. Hand the interpreter a file and it executes it:
total = 0
for price in [4.50, 2.25, 9.00]:
total += price
print(f"Total: ${total:.2f}") # Output: Total: $15.75
Five lines, no class, no main, no build file. That is most of Python's appeal in one
example: the ceremony-to-work ratio is low.
Indentation is the syntax
Most languages use braces to mark a block and indentation to make it readable, which means the two can disagree. Python removes the possibility by using indentation itself.
balance = 120
if balance > 100:
print("Premium") # inside the if — indented
print("Free postage") # also inside
print("Done") # outside — back at the left margin
# Output: Premium
# Output: Free postage
# Output: Done
The colon opens a block and the indentation says what is in it. This is not a style preference you can ignore: change the spacing and you change the meaning, exactly as moving a brace would elsewhere. Use four spaces, never tabs, and let your editor enforce it.
The payoff is that all Python looks broadly the same. There is no argument about brace placement because there are no braces.
Types exist, declarations do not
Every value has a type. Variables do not — a variable is a name pointing at a value, and pointing it somewhere else is legal.
x = 42
print(type(x)) # Output: <class 'int'>
x = "forty two"
print(type(x)) # Output: <class 'str'>
This is dynamic typing, and it is why Python is quick to write. What it costs you is that a type mistake surfaces when the line runs rather than when you build:
"3" + 4
That raises TypeError: can only concatenate str (not "int") to str — a real error,
just a late one. Python will not quietly turn the number into a string the way JavaScript does. It is
strongly typed and dynamically typed, which are two different questions people often
merge into one.
Type hints let you write the types down for a checker to verify without changing how the code runs. That is a whole post of its own — Dataclasses & Type Hints.
The standard library is the selling point
Python ships with an unusual amount already in the box: JSON, CSV, SQLite, HTTP, dates, zip files, hashing, unit testing, argument parsing. For a large class of small jobs you install nothing at all.
import json
order = {"item": "Pizza", "qty": 2, "price": 15.50}
print(json.dumps(order)) # Output: {"item": "Pizza", "qty": 2, "price": 15.5}
Two lines and no dependency. When you do need something external — requests,
pandas, django — pip fetches it, and the ecosystem around data
work in particular has no real rival.
Python 2 is gone — but its answers are not
Python 2 reached end of life in January 2020. You will never write it. You will, however, land on Python 2 answers when you search, because fifteen years of them are still indexed, and they fail in confusing ways.
The giveaway is print used as a statement rather than a function:
print "hello"
That is a SyntaxError in Python 3, and it is the fastest way to spot an answer written
for a language you are not using. Two other tells: xrange instead of range,
and integer division quietly happening when you wrote /. If you see any of the three,
scroll on and find a newer answer.
Where Python is used
- Data, machine learning and AI — the dominant language, not merely a popular one. Nearly every major model library has a Python interface first.
- Web backends — Django, Flask and FastAPI.
- Automation and scripting — the job that would be an unreadable shell script.
- Testing and tooling — build scripts, deployment glue, CI.
What Python is bad at
Worth knowing before you pick it for something it will not do well.
Raw speed. Interpreted code is far slower than compiled C, Rust or Java for tight numeric loops. The usual answer is that the slow part is not written in Python — NumPy and friends are C underneath, and you are steering rather than computing.
CPU-bound threading. The Global Interpreter Lock means threads do not give you
parallel CPU work in the standard build. Use multiprocessing for that. 3.13 introduced a
free-threaded build and 3.14 supports it properly, but this is still changing.
Shipping to end users. Handing someone a Python program means dealing with getting Python onto their machine. A single compiled binary is simpler.
Where to go next
Data Types is the next post: the handful of types you will use in every program, and what a variable really is.
If you have not installed Python or run anything yet, go back to Get Started first — the rest of the track assumes you can run a file.