Python

Python is a high-level, interpreted language that prizes readability and simplicity — code often reads like executable pseudocode. That clarity, plus an enormous library ecosystem, makes it the default choice for data science, machine learning, automation, and a large share of backend development.

Why it exists: Guido van Rossum created Python in the late 1980s to be easy to read and pleasant to use (named after Monty Python, not the snake). It consistently ranks among the top languages in use and is the most common teaching language. Where it fits: Python dominates data/ML and scientific computing and is a strong backend choice; its main trade-off is raw speed (it's interpreted), which matters for CPU-bound work but rarely for the I/O-bound and glue tasks it excels at.

TL;DR

Quick Example

A comprehension expresses transform-and-filter in one readable line:

Core Concepts

Key terms

Common acronyms

PEP (Python Enhancement Proposal; PEP 8 = style guide), pip (installer), PyPI (package index), venv (virtual environment), GIL (Global Interpreter Lock), REPL (interactive shell).

What beginners misunderstand

How Python Runs

Python compiles your source to bytecode, then the PVM interprets it. Complexity tends to arise around the GIL, package/environment management, the import system (circular imports), and memory (reference cycles, large datasets).

Implementations

Common Uses

Tooling & Ecosystem

Python (PSF License) and its ecosystem are overwhelmingly open-source; proprietary layers focus on ML platforms (Databricks, SageMaker, Vertex AI).

Performance & Scaling

Best Practices

Comparison

See Go and JavaScript.

Common Mistakes

Mutable default arguments

is vs ==

Myths vs reality

FAQ

What is the GIL and does it make Python slow?

The Global Interpreter Lock serializes execution of Python bytecode, so multithreading doesn't help CPU-bound work — but it doesn't affect I/O-bound concurrency (asyncio/threads) or C extensions like NumPy (which release it). For parallel CPU work, use multiprocessing. A no-GIL CPython is in development.

Python 2 or Python 3?

Always Python 3 — Python 2 reached end of life in 2020 and receives no updates.

When should I not use Python?

For CPU-bound, performance-critical work (Rust/Go/C++), hard-real-time systems (GC pauses), browser code (JavaScript), and native mobile apps. Python shines for data/ML, scripting, automation, and I/O-bound backends.

Do I need type hints?

Not to run code, but yes for any sizable or team codebase — they catch bugs, power autocomplete, and document intent. Pair them with mypy or pyright in CI.

CPython, PyPy, or something else?

CPython is the right default. Switch to PyPy for long-running CPU-bound programs that need its JIT speedup (and don't depend on incompatible C extensions). MicroPython targets microcontrollers; Anaconda packages the scientific stack.

Related Topics

References