Skip to main content

Python Glossary - A-Z Reference 📚

A comprehensive reference of Python programming terms. Each term includes a clear definition and links to relevant tutorial pages for deeper learning.


A-C​

Argument — A value passed to a function when calling it. Arguments are assigned to the function's parameters. See Functions.

Boolean — A data type with two values: True and False. Used in conditionals and logical operations. See Booleans.

Break — A statement that exits a loop prematurely. When executed inside a for or while loop, it stops the loop immediately. See Break/Continue/Pass.

Class — A blueprint for creating objects. Classes define attributes and methods that instances of the class will have. See Classes & Objects.

Comment — Text in code that is ignored by the interpreter. Comments start with # and are used to explain code. See Syntax & Comments.

Comprehension — A concise syntax for creating sequences (lists, dicts, sets) from iterables. E.g., [x**2 for x in range(10)]. See List Comprehension.

Constructor — A special method __init__() that is called when an object is created from a class. It initializes the object's attributes. See Constructors.

Continue — A statement that skips the rest of the current loop iteration and moves to the next one. See Break/Continue/Pass.


D-F​

Dictionary — A mutable, unordered collection of key-value pairs. Created with {} or dict(). Keys must be immutable. See Dictionaries.

Docstring — A string literal that appears as the first statement in a function, class, or module. Used for documentation. Enclosed in triple quotes """...""".

Exception — An event that disrupts normal program flow. Raised by errors (e.g., ZeroDivisionError, TypeError) and can be handled with try/except. See Exceptions.

File — An object representing a file on disk. Python provides built-in functions like open() to read from and write to files. See File Handling.

Float — A data type representing floating-point numbers (numbers with decimal points). E.g., 3.14, -0.5. See Numbers & Casting.

Function — A reusable block of code defined with def. Functions take arguments, perform actions, and can return values. See Functions.


G-I​

Generator — A function that uses yield instead of return to produce a sequence of values lazily. Generators are memory-efficient for large datasets. See Decorators & Generators.

IDLE — Python's built-in Integrated Development and Learning Environment. A simple IDE that comes bundled with Python installations.

Import — A statement that brings modules or specific objects from modules into the current namespace. E.g., import math, from sys import argv. See Modules.

Inheritance — An OOP concept where a class derives attributes and methods from a parent class. Enables code reuse and hierarchical relationships. See Inheritance.

Integer — A whole number data type (positive, negative, or zero). E.g., 42, -7, 0. See Numbers & Casting.

Interpreter — The program that executes Python code line by line. Python is an interpreted language; the interpreter reads, compiles, and runs code. See What is Python?.

Iterable — Any Python object that can be looped over with a for loop. Examples include lists, strings, tuples, dicts, and files. Implements the __iter__() or __getitem__() method.


J-L​

Lambda — A small anonymous function defined with the lambda keyword. Can take any number of arguments but has only one expression. E.g., lambda x: x * 2. See Lambda Functions.

List — An ordered, mutable collection of items. Created with [] or list(). Lists can contain mixed data types and support indexing, slicing, and methods like append(), pop(). See Lists.

Loop — A construct that repeats a block of code. Python has for loops (iterate over sequences) and while loops (repeat while a condition is true). See Loops.


M-O​

Method — A function that belongs to an object or class. Methods are called on instances (e.g., "hello".upper()) or on the class itself (e.g., classmethod). See Classes & Objects.

Module — A file containing Python definitions and statements. Modules allow you to organize code into reusable files. Imported using the import statement. See Modules.

Mutability — Whether an object's value can be changed after creation. Mutable types: list, dict, set. Immutable types: int, float, str, tuple, frozenset. See Variables & Data Types.

Namespace — A container that maps names to objects. Each module, function, and class has its own namespace. The LEGB rule (Local, Enclosing, Global, Built-in) determines name resolution order.

None — A special constant representing the absence of a value. Its type is NoneType. Often used as a default return value or to signify "no result."

Object — The fundamental building block in Python. Everything in Python is an object: numbers, strings, functions, classes. Objects have attributes and methods.

Operator — A symbol that performs an operation on values. Categories include arithmetic (+, -, *), comparison (==, <, >), logical (and, or, not), and assignment (=, +=). See Operators.


P-R​

Package — A collection of related modules organized in directories. A directory must contain an __init__.py file to be treated as a package. See Packaging.

Parameter — A variable listed in a function's definition that receives an argument when the function is called. Parameters are placeholders; arguments are the actual values. See Functions.

PIP — Python's package installer. Used to install third-party packages from the Python Package Index (PyPI). E.g., pip install requests.

REPL — Read-Eval-Print Loop. Python's interactive shell where you type commands and see results immediately. Access by running python without a script.

Return — A statement that exits a function and optionally sends a value back to the caller. A function without an explicit return returns None.


S-U​

Set — An unordered collection of unique elements. Created with {} or set(). Supports mathematical operations like union, intersection, and difference. See Sets.

Slice — A syntax for extracting a portion of a sequence. Written as sequence[start:stop:step]. E.g., "hello"[1:4] returns "ell".

Statement — A unit of code that Python can execute. Examples: assignment (x = 5), if statements, for loops, import statements.

Str — The string data type representing text. Strings are immutable sequences of Unicode characters. Created with single quotes, double quotes, or triple quotes. See Strings.

Syntax — The set of rules that defines how Python code must be written. Python uses indentation to define blocks, unlike curly braces in other languages. See Syntax & Comments.

Tuple — An ordered, immutable collection of items. Created with () or tuple(). Often used for fixed collections of values. See Tuples.

Type — The classification of data in Python. Determines what operations can be performed on a value. Use type() to check an object's type. See Variables & Data Types.


V-Z​

Variable — A name that references a value stored in memory. In Python, variables are created by assignment and do not require explicit type declaration. See Variables & Data Types.

Virtual Environment — An isolated Python environment that allows you to manage dependencies for different projects separately. Created with python -m venv myenv.

While — A loop that continues executing as long as its condition evaluates to True. Use when the number of iterations is not known in advance. See Loops.

With — A statement used for resource management. Ensures that resources (files, network connections) are properly cleaned up after use. See File Handling.

Zen of Python — A collection of 19 guiding principles for Python design. Written by Tim Peters. Access it by typing import this in the Python interpreter.



Master these terms and you will speak Python fluently. Bookmark this page for quick reference!