{"canonical_url":"https://engineer.company/glossary/python/","content_markdown":"# Python\n\n## What it is\n\nPython is a general-purpose programming language whose source is run by an\ninterpreter rather than compiled ahead of time into a separate binary. Its own\ndocumentation calls it interpreted, interactive and object-oriented, with\nmodules, exceptions, dynamic typing and high-level data types built in. The\ntrait most people notice first is that indentation is syntax: a block is\nwhatever is indented under the line that opens it, so the layout a reader sees\nis the structure the interpreter runs. Guido van Rossum began it over the 1989\nChristmas holidays, drawing on his work on the ABC language at CWI in Amsterdam,\nposted it in February 1991, and named it after the scripts of Monty Python's\nFlying Circus he was reading at the time.\n\nTyping is dynamic. A name is bound to an object while the program runs, and the\ntype belongs to the object, not to the name, so the same variable can hold a\nnumber on one line and a string on the next. Optional annotations, standardised\nby PEP 484, let a function declare what it expects and returns, but that PEP is\nexplicit that no type checking happens at runtime and that Python is going to\nstay a dynamically typed language. The annotations are read by separate tools,\ntype checkers and editors, while the interpreter stores them without enforcing\nthem.\n\nThe language ships with a large standard library, which the tutorial describes\nas batteries included: files, JSON, SQLite, regular expressions, subprocesses,\nargument parsing and more, all without installing anything. Everything else\ncomes as third-party packages, usually installed with pip from the Python\nPackage Index. Because one interpreter can only hold one version of each\npackage, the standard library also includes `venv`, which creates a\nself-contained environment per project, so that one application can use version\n1.0 of a library while another uses 2.0.\n\nNew versions arrive on a calendar. Since Python 3.9, PEP 602 has put a feature\nrelease out every October after about seventeen months of development, and each\none is maintained for five years; from 3.13 on, that means two years of regular\nbugfix releases, roughly every other month, then three years of security fixes\nonly. Python 3.15.0 came out on 9 October 2026. Python 3.10 reached its end of\nlife on 1 October 2026, and Python 2.7, the last of the second series, stopped\nreceiving support on 1 January 2020. The reference interpreter, CPython, has\nlong had a global interpreter lock that lets only one thread execute Python code\nat a time; PEP 703 added a build without it, and PEP 779 named 3.14 as the time\nframe for the phase in which that free-threaded build is officially supported\nbut still optional.\n\n## Why it matters\n\nPython is often the shortest path from a question to a working program. A script\nthat reads a file, queries a database and writes a report can be written with\nnothing but the standard library, run immediately, and changed without a build\nstep. That is why it so often ends up as the glue in data pipelines, build\ntooling and test harnesses.\n\nReadability is a deliberate design goal rather than a side effect. The Zen of\nPython, PEP 20, says that readability counts, and PEP 8, the style guide for the\nstandard library, settles the questions a team would otherwise argue about, from\nnaming to the 79-character line.\n\nThe flexibility has a cost, and it arrives late. A misspelt attribute, a `None`\nwhere a string was expected or a wrong argument type is an error only when that\nline runs, which may be in production. Teams that rely on Python for anything\nlasting therefore add the checks the language leaves out: a linter, annotations\nwith a type checker in the gate, and tests that actually execute the code paths.\n\nThe calendar matters as much as the code. Every interpreter version has a fixed\nend date, so an installation nobody touches drifts out of security support on a\npublished schedule. A project that names its minimum version and moves forward\nwithin the two bugfix years trades an emergency for one planned upgrade a year.\n\n## What it looks like in practice\n\nIn the portfolio, Python powered\n[a database-driven CV and portfolio generator](/portfolio/built-a-database-driven-cv-generator/)\nat one documented stage:\n41 modules and 10,580 lines that rendered six output formats, from HTML and PDF to\nMarkdown and JSON, out of one SQLite database of 23 tables. A pipeline of 19\nsteps built that database, each step safe to repeat. Runtime dependencies were\nheld to exactly two, a template engine and a PDF renderer, on the argument that\na document generator that cannot be installed in five years has preserved\nnothing. In return, every document then depended on that Python code, with no\nother way left to produce one. These counts describe the implementation at that\ndocumented stage.\n\nPython also won a direct comparison in\n[an hourly electricity consumption pipeline](/portfolio/a-month-of-meter-readings-in-180-milliseconds/),\nwhich was built three ways, in Python, in JQ and in SQL on PostgreSQL, to turn\nirregular readings into one row per hour and zone, with net consumption as\nproduction plus imports minus exports. The version written as pure Python\nfunctions was the fastest, handling a day of data in 34 ms and a 30-day dataset\nin 180 ms.\n\nThis site is built by Hugo. In the tooling snapshot recorded in October 2026,\nits 22 helper scripts, 8,408 lines in all, were written in Python. Every one of\nthem used the standard library alone except the script that imported drawings, which needed Pillow to trim them. The `.tool-versions` file\nnamed Python 3.14.7 with the policy that the interpreter could be newer but never\nolder, and `task doctor` asserted that against the installed binary rather than\ntrusting the file. Ruff was the linter, and basedpyright checked types at its\n`standard` level, because its default level reported 358 findings that were\nalmost all about missing annotations in code that was plain on purpose. On its\nfirst run the type checker found a value that could be `None` being used as a\ndictionary key, a defect Ruff had passed clean.\n\n## Where it goes wrong\n\nMost Python trouble comes from code that the interpreter accepts without\ncomplaint and that behaves differently from how it reads.\n\n**A default argument remembers earlier calls.** A function returns a list that\nstill holds items from previous calls, so results depend on call order. A\ndefault value is evaluated once, when the `def` statement runs, so a mutable\ndefault such as a list or dictionary is one shared object for every call that\nomits the argument. Use `None` as the default and create the list inside the\nbody; Ruff's B006 rule reports the pattern.\n\n```python\ndef add_tag(tag, tags=None):\n    if tags is None:\n        tags = []  # a new list on every call\n    tags.append(tag)\n    return tags\n```\n\n**Projects break each other's dependencies.** Upgrading a library for one\nproject breaks another, or `pip install` stops with an error about an externally\nmanaged environment. Both are packages installed straight into a shared\ninterpreter: the projects compete for one copy of each library, and under PEP\n668 an operating system distributor can mark its own Python as off limits to\npip. Give each project its own environment with `python -m venv .venv`, install\ninto that, and record the dependencies in a file so the environment can be\nrebuilt.\n\n**Type hints are trusted as if they were checks.** A function annotated to take\nan `int` receives a string from a JSON file, and the failure surfaces three\ncalls later. Annotations describe intent; the interpreter does not enforce them.\nRun a type checker as part of the gate so mismatches between annotated code fail\nthe build, and validate data where it enters the program, since no annotation\ncan vouch for input.\n\n**An interpreter ages out of support.** A server keeps the version it was\ninstalled with until security releases for it stop and packages drop it from\ntheir supported range. Each feature version gets five years, and the five years\nof 3.10 ended on 1 October 2026. Name the minimum version in a file that a check\nreads, move up within the two bugfix years of each release, and run the test\nsuite on the new version before switching.\n\n## Further reading\n\n- [Python documentation](https://docs.python.org/3/) — the tutorial, the library\n  reference and the language reference for the current release.\n- [The Python Tutorial](https://docs.python.org/3/tutorial/index.html) — the\n  language from first principles, including the warning about mutable default\n  arguments.\n- [PEP 8 – Style Guide for Python Code](https://peps.python.org/pep-0008/) — the\n  layout and naming conventions most Python code follows.\n- [PEP 602 – Annual Release Cycle for Python](https://peps.python.org/pep-0602/)\n  — why a feature release lands every October and how long each is supported.\n- [PEP 484 – Type Hints](https://peps.python.org/pep-0484/) — the annotation\n  syntax and why the interpreter leaves checking to other tools.\n- [Virtual Environments and Packages](https://docs.python.org/3/tutorial/venv.html)\n  — creating one environment per project with `venv` and installing into it with\n  pip.\n\n\u003chttps://engineer.company/glossary/python/\u003e\n","date_modified":"2026-11-09T21:50:25Z","description":"How Python runs plain, indented source, why its October release calendar sets every project a deadline, and where type hints and defaults mislead.","formats":{"gemtext":"https://engineer.company/glossary/python/index.gmi","gopher":"https://engineer.company/glossary/python/gophermap","html":"https://engineer.company/glossary/python/","json":"https://engineer.company/glossary/python/index.json","markdown":"https://engineer.company/glossary/python/index.md","pdf":"https://engineer.company/glossary/python/index.pdf"},"kind":"page","language":"en","title":"What is Python?","url":"https://engineer.company/glossary/python/","version":1}