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 of a Python function with **kwargs collecting keyword arguments into a dictionary
Python

Python **kwargs: How It Works and When to Use It

python **kwargs: Understand how Python's **kwargs collects extra keyword arguments, common usage patterns, pitfalls, and when to prefer explicit parameters.

pythonkwargsfunction argumentspython syntax
Editorial illustration of a Python asterisk symbol gathering multiple function arguments into an ordered tuple container.
Python

Python *args: Flexible Function Arguments Explained

python *args: Learn how Python *args collects extra positional arguments, when to use it, and how it interacts with other parameter types.

python functionsfunction argumentspython syntaxkwargs
Editorial illustration of a Python function collecting a variable number of arguments into a tuple and a dictionary.
Python

Python Arbitrary Arguments: *args and **kwargs

Understand how Python's *args and **kwargs collect variable-length positional and keyword arguments, how parameter ordering works, and when to use them in production code.

pythonargskwargsfunction parameters
A clean illustration of a Python function signature with a bare asterisk separating positional and keyword-only parameters.
Python

Python Keyword-Only Star Syntax Explained

Learn how the bare * in Python function signatures enforces keyword-only arguments, with examples and common pitfalls.

keyword-only argumentsfunction signaturespython syntaxparameter handling
Diagram showing Python function parameter ordering with positional-only slash and keyword-only star syntax.
Python

Python Positional-Only Slash Syntax Explained

python positional only slash syntax: Learn how the slash syntax defines positional-only parameters in Python, why it matters for API design, and how to combine it with...

pythonfunction-signaturespositional-argumentskeyword-arguments
Illustration of a Python function signature with an asterisk separating positional and keyword-only parameters, emphasizing enforced keyword arguments.
Python

Python Keyword-Only Parameters: Syntax and Use Cases

Python keyword-only parameters force callers to pass arguments by name after `*`. Learn the syntax and when to use them for clearer APIs.

keyword argumentsfunction parametersPython syntaxAPI design
Illustration of a Python function signature with a slash separating positional-only parameters, representing the syntax for positional-only arguments.
Python

Python Positional-Only Parameters: Syntax and Use Cases

Learn how Python's positional-only parameters work, why they matter for API design, and how to use them correctly in your functions.

pythonfunction parameterspositional-onlykeyword-only
Illustration comparing positional and keyword arguments in Python function calls
Python

Python Positional vs Keyword Arguments

Understand the difference between positional and keyword arguments in Python, including their syntax, ordering rules, and when to use each style.

Pythonfunction argumentskeyword argumentspositional arguments
Illustration showing Python function parameters receiving values in order, with numbered positions mapping to arguments
Python

Python Positional Arguments: Order and Binding Rules

Learn how Python positional arguments bind by order, how to mix them with keyword arguments, and how *args or positional-only parameters create clearer APIs.

python functionsfunction argumentskeyword argumentsargs
Illustration showing named parameters flowing into a Python function container
Python

How Python Keyword Arguments Work

Learn how Python keyword arguments work, including keyword-only and positional-only parameters, **kwargs, ordering rules, and API design guidelines.

pythonkeyword-argumentsfunction-parametersapi-design