Dev Helpers

Python / Functions

Use positional-only parameters

Dev Helpers · October 7, 2025

A positional-only parameter lets a library change its internal argument name without breaking keyword callers. The slash marks the boundary.

Worked example

def divide(a, b, /):
    return a / b
print(divide(9, 3))

Result

3.0

Implementation notes

A positional-only name can still appear as a key in a separate dictionary argument. The restriction describes how the function is called, not which strings are valid data.

Try it yourself

Call the function once by position and once using the parameter name.

Open the Python example →

Editorial date October 7, 2025 · Published December 6, 2026

Related articles

Run an async function

An async function call creates a coroutine. A top-level runner supplies the event loop that executes it.

Transpose a matrix

Transposing rows into columns assumes a decision about uneven rows. Ordinary zip stops at the shortest input.

Unpack with a remainder

Starred unpacking separates a fixed header from a variable-length tail. It still requires enough elements for the fixed positions.