Pages

Topics

Tools

↑↓navigate↵openescclose

Python guides

Every published Python guide, newest first, with practical examples you can copy into your own project.

3,965 guides across 14 topics

Topics

Latest Python guides

Illustration comparing the Python equality operator == with the identity operator is, showing two objects with equal values but distinct memory addresses.
Python

Python Equality Operator: How == Really Works

Learn how the Python equality operator works under the hood: == vs is, __eq__ dispatch, custom equality, and hashability.

pythonequality operator__eq__object identity
Illustration of Python comparison operators showing two abstract data blocks being compared with a balance scale and a boolean result indicator.
Python

Python Comparison Operators: Syntax and Chaining

python comparison operators: A practical reference to Python comparison operators: syntax, chained comparisons, equality vs identity, type behavior, and common edge ca...

pythoncomparison operatorspython syntaxequality vs identity
Illustration of the Python augmented exponentiation operator **= showing a variable being raised to a power and assigned back.
Python

Understanding the Python **= Operator

Learn how Python's **= augmented assignment operator works with numeric types, how it evaluates targets once, and how to avoid common edge cases.

augmented assignmentexponentiationpython operatorssyntax
Illustration of the Python modulo assignment operator showing a variable being updated with the remainder of a division.
Python

Python %= Operator: Modulo Assignment Explained

Python's %= augmented assignment operator computes a remainder and stores it back in one step. See how it works with integers, floats, custom objects, and common edge cases.

Python operatorsaugmented assignmentmoduloPython syntax
Illustration of a Python code snippet showing the //= operator dividing a number and assigning the result back to the variable.
Python

Python //= Operator: In-Place Floor Division

Learn how Python's //= operator performs floor division and assigns the result in one step, with examples and edge cases.

Python operatorsfloor divisionaugmented assignmentinteger arithmetic
Diagram showing a variable being divided and assigned back with the /= operator in Python.
Python

Python /= Operator: Syntax and Behavior

Learn how Python's /= operator performs division, how in-place semantics differ for mutable objects, and common pitfalls to avoid.

Pythonaugmented assignmentin-place operatorsdivision
Diagram showing a variable being multiplied and reassigned, with a container representing in-place mutation for mutable types.
Python

Python *= Operator: How It Works and When to Use It

Learn how Python's *= operator works, including in-place semantics for mutable types and how to control it in your own classes.

pythonaugmented assignmentin-place operatorsoperator overloading
Illustration of Python's -= operator showing in-place subtraction on a mutable set, with a set being reduced and a minus-equals symbol.
Python

Python -= Operator: In-Place Subtraction Explained

Understand how Python's -= operator works for numbers, lists, sets, and custom objects, and when it differs from a = a - b.

pythonaugmented assignmentin-place operationsmutable types
Illustration of the python += operator showing a variable being augmented with a new value while a list object is mutated in place.
Python

Understanding Python's += Operator

Explains how Python's += operator behaves for immutable and mutable types, where it reassigns versus mutates in place, and how to avoid common mistakes.

augmented assignmentpython syntaxmutable objectsin-place operations
Python code snippet showing an augmented assignment operator with a list being modified in place, illustrated with a visual metaphor of a container being filled.
Python

Python Augmented Assignment Operators Explained

python augmented assignment operators: Understand how Python augmented assignment operators like += and *= behave for mutable and immutable objects, including in-place...

augmented assignmentpython operatorsin-place operationsmutable objects