The glossary

Every term, defined 📖

69 terms, A to Z, each linking back to the lesson that teaches it properly. Beginners revisit vocabulary constantly; this is one place to do it.

argument
A value you pass into a function when you call it. Different from a parameter, which is the name the function gives it. Lesson 17
assert
A statement that raises AssertionError if its condition is false. The simplest form of a test. Lesson 29
async / await
Keywords for concurrency: async def makes a coroutine that can pause at await points, letting thousands of tasks share one thread while they wait. Lesson 40
boolean
A value that is either True or False. Named after George Boole. Lesson 6
bug
A gap between what you believe your code does and what it actually does. Found by making beliefs visible and testing them. Lesson 10
class
A blueprint that bundles data (attributes) and the operations on it (methods) into one named type. Lesson 31
closure
A function that remembers variables from the scope where it was defined, even after that scope has finished. The basis of decorators. Lesson 19
comprehension
A one-line way to build a list, dict or set from a loop, e.g. [n*n for n in range(5)]. Lesson 16
context manager
An object used with with that guarantees setup and cleanup happen, even if an error is raised. Files are the classic example. Lesson 36
context window
The maximum amount of text, measured in tokens, a language model can consider at once, including the whole conversation and its reply. Lesson 53
dataclass
A class decorated with @dataclass so Python writes its __init__, __repr__ and __eq__ from the field annotations. Lesson 33
decorator
A function that wraps another function to add behaviour, applied with @name above a definition. Lesson 35
dictionary
A collection of key-value pairs, looked up by key rather than by position. The container real programs are made of. Lesson 13
docstring
A string as the first line of a function, class or module, kept by Python as its documentation and shown by help(). Lesson 17
duck typing
Caring whether an object has the method you need, not what class it is. 'If it quacks like a duck.' Lesson 32
embedding
A list of numbers representing the meaning of a piece of text, so that similar meanings have similar vectors. The engine of semantic search. Lesson 58
environment variable
A value stored outside your code, in the operating system's environment, used to keep secrets like API keys out of your files. Lesson 54
exception
An error raised at runtime that stops normal flow, handled with try and except. Lesson 22
f-string
A string prefixed with f whose {braces} are replaced by the values inside them. The one obviously correct way to build text from values. Lesson 4
float
A number with a decimal point. Stored in binary, so tiny rounding errors are normal; use Decimal for money. Lesson 3
function
A named, reusable block of steps. The single most important idea for keeping programs understandable. Lesson 17
generator
A function using yield that produces values lazily, one at a time, using almost no memory. Lesson 34
GIL
The Global Interpreter Lock: in standard CPython, only one thread runs Python bytecode at a time, so threads speed up waiting but not CPU-bound work. Lesson 39
hallucination
When a language model produces fluent but fabricated output. A property of predicting plausible text, not a bug that can be fully removed. Lesson 53
immutable
Unable to be changed after creation. Strings, tuples and frozen dataclasses are immutable; lists and dicts are not. Lesson 4
indentation
The leading spaces that define blocks in Python. Unlike most languages, the layout is the syntax. Four spaces, never tabs. Lesson 7
index
The position of an item in a sequence, counting from zero. x[0] is the first item, x[-1] the last. Lesson 4
int
A whole number. Python integers grow to any size and never overflow. Lesson 3
interpreter
The program that runs your Python. Standard Python is CPython; Pyodide is CPython compiled to run in a browser. Base Camp 3
JSON
A text format for structured data, borrowed from JavaScript, used by nearly every web API. Maps onto Python dicts and lists. Lesson 23
lambda
A tiny anonymous function of one expression, e.g. lambda x: x*2. For throwaway use as an argument, never assigned to a name. Lesson 37
list
An ordered, changeable collection. The default container in Python. Lesson 11
list comprehension
See comprehension. Lesson 16
local scope
The region inside a function where its own variables live. Names assigned in a function are local unless declared otherwise. Lesson 19
method
A function that belongs to an object, called with a dot, e.g. text.upper(). Lesson 4
module
A .py file of code you can import. The standard library is hundreds of them. Lesson 20
mutable
Able to be changed in place after creation. Lists, dicts and sets are mutable; the source of the aliasing surprise. Lesson 11
None
Python's value for 'deliberately nothing'. Returned by functions with no return; compared with is None. Lesson 6
PEP 8
Python's official style guide. Following it means any Python programmer can read your code without friction. Lesson 30
pip
The tool that installs packages from PyPI into your environment. Lesson 26
prompt injection
An attack where text the model reads contains hidden instructions aimed at it. Unsolved, and the central risk of giving a model tools. Lesson 62
property
A method used like an attribute via @property, so a value can be computed on demand or validated on assignment. Lesson 31
PyPI
The Python Package Index: half a million public packages installable with pip. Lesson 26
RAG
Retrieval-augmented generation: find the relevant piece of your own data and paste it into the prompt so a model can answer from information it was never trained on. Lesson 58
recursion
A function that calls itself. Needs a base case that returns without recursing, or it runs forever. Lesson 58
regular expression
A tiny language for describing shapes of text, used via the re module for search and replace. Lesson 25
REPL
The interactive Python prompt (Read, Evaluate, Print, Loop). A calculator that speaks Python; the best tool for 'what does this do?'. Base Camp 6
return
Hands a value back from a function to its caller. Different from print, which shows a value and returns nothing. Lesson 17
scope
Where a name is visible. Python searches Local, Enclosing, Global, Built-in, in that order (LEGB). Lesson 19
secrets
The standard module for cryptographically safe random values: tokens, passwords, keys. Never use random for security. Lesson 52
set
An unordered collection with no duplicates and instant membership testing. Lesson 14
shadowing (variable)
Reusing a name with a fresh let-style assignment, or accidentally hiding a built-in like list by assigning to that name. Lesson 19
slice
A piece of a sequence, x[start:stop], including the start and excluding the stop. Lesson 4
SQL injection
An attack where user input rewrites a database query. Prevented by parameterised queries with ? placeholders, never f-strings. Lesson 45
streaming
Displaying a model's reply token by token as it is generated, so the wait feels alive rather than frozen. Lesson 56
string
Text, written in quotes. A sequence of characters, and immutable. Lesson 4
system prompt
Standing instructions that set an assistant's persona and rules, applied to every turn, separate from the conversation. Lesson 54
temperature
A dial controlling how randomly a model samples its next token. Low is focused and predictable; high is creative and surprising. Lesson 53
token
The chunk of text a language model reads and predicts, roughly three-quarters of a word. You pay per token. Lesson 53
tool use
Letting a model ask your code to run functions (function calling), so it can act: check data, do maths, control things. Powerful and risky. Lesson 57
traceback
The report Python prints when an exception is not caught, naming what broke, where, and why. Read it from the bottom. Lesson 10
truthiness
How any value is treated as True or False: empty and zero are falsy, everything else is truthy. Lesson 6
try / except
The way to handle exceptions: attempt the risky code, catch the specific errors you can deal with. Lesson 22
tuple
An ordered, unchangeable collection. Documents that a fixed group of values belongs together. Lesson 12
type hint
An annotation like name: str that documents the expected type. Not enforced at runtime, but checked by tools like mypy. Lesson 38
unpacking
Assigning several names from a sequence at once, e.g. a, b = point, or spreading with a star. Lesson 12
variable
A label attached to a value, created with =. In Python the value has a type; the label does not. Lesson 2
virtual environment
A private, isolated set of installed packages for one project, so projects with conflicting versions never collide. Lesson 26
walrus operator
:=, which assigns a value and returns it in one expression, e.g. if (n := len(x)) > 3:. Lesson 41