python · reference

Glossary

26 terms that recur across the curriculum. Skim before starting; refer back as needed.

big-o

Growth of time/space

Big-O describes how runtime or memory grows as input size increases.

casting

Convert between types

Use int(), float(), str() to convert values between types.

class

Blueprint for objects

Classes define data and behavior; instances are the actual objects.

comprehension

Compact collection builder

Comprehensions build lists/sets/dicts in a single readable line.

dictionary

Key → value mapping

Dictionaries (dict) map unique keys to values using hashing.

dynamic typing

Types checked at runtime

In Python, variable types are determined when the program runs, not at compile time.

exception

Runtime error signal

Exceptions are raised on errors and handled with try/except.

expression

Produces a value

Expressions evaluate to a value, e.g., 3 + 2 or len(name).

generator

Lazy iterator created with yield

Generators produce values on demand and save memory.

hash

Numeric fingerprint of a value

Hash functions map keys to table indices; required for dict/set keys.

hashing

Map keys to indices

Hashing converts keys into numbers used to index hash tables.

immutable

Cannot be changed in place

Immutable objects (int, float, str, tuple) cannot be modified; new objects are created instead.

indentation

Defines code blocks

Python uses indentation (usually 4 spaces) to group statements into blocks.

instance

A concrete object

An instance is a specific object created from a class.

iterator

Object that yields items one by one

Iterators implement __next__ and are consumed sequentially.

list

Ordered, mutable collection

Lists store items in order and can grow or shrink dynamically.

mutable

Can be changed in place

Mutable objects (list, dict, set) can be modified without creating a new object.

none

The absence of a value

None represents “no value” and is often used as a default or placeholder.

object

A value with a type

Everything in Python is an object: it has a type, identity, and value.

repl

Interactive shell

REPL = Read–Eval–Print Loop, where you can run Python interactively.

scope

Where a name is visible

Local, enclosing, global, and built-in scopes determine name resolution (LEGB).

set

Unordered, unique collection

Sets store unique items with fast membership checks.

slicing

Subsequence extraction

Slicing selects parts of a sequence using [start:stop:step].

statement

Performs an action

Statements do work, e.g., print(...), if/for/while, or assignment.

tuple

Ordered, immutable collection

Tuples are fixed-size sequences often used for safe grouping.

variable

A name bound to an object

Variables are labels that point to objects in memory. Rebinding a name does not change the object itself.