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
Popular Python guides
Most readLatest Python guides
Page 133 of 179Python Default Arguments: Mutable Pitfalls
Understand why Python evaluates default arguments once, how mutable defaults cause shared-state bugs, and how to use the None sentinel pattern.
Python Default Parameters: Avoiding Mutable Defaults
python default parameters: Understand how Python evaluates default parameters at definition time and why mutable defaults cause shared state. Learn the None sentinel p...
How to Return Multiple Values from a Python Function
Learn practical ways to return multiple values from a Python function: tuples, dictionaries, namedtuples, and dataclasses, with guidance on when each one is the best choice.
Python Return Values: Syntax, Behavior, and Pitfalls
Understand Python return values: return syntax, implicit None, tuple unpacking, type hints, generator alternatives, and finally-block edge cases.
Understanding the Python Return Statement
Learn how Python's return statement works: syntax, multiple values, implicit None, early exits, and differences from yield.
Python Parameter vs Argument: The Real Difference
Learn the precise difference between parameters and arguments in Python, how they interact, and why the distinction improves code clarity.
Python Function Arguments: Syntax, Defaults, and *args/**kwargs
python function arguments: Learn how Python function arguments work: positional, keyword, default, *args, and **kwargs, with practical examples and common pitfalls.
Python Function Parameters: Syntax and Usage
Learn how Python function parameters work: positional, keyword, default, *args, **kwargs, and ordering rules for clean, maintainable function signatures.
Python Function Call: Syntax, Binding, and Behavior
How Python evaluates a function call: argument evaluation order, binding, defaults, return values, callable objects, and call overhead.
Python def Keyword: Defining Functions
Learn how Python's def keyword defines functions, handles parameters, return values, scope, and decorators, with practical code examples.