4 ms·
When args are positional-only, you can rename them without breaking callers. The names of the kwargs can be considered "external" and the names of the positiona
by shrimpx 3y ago
When args are positional-only, you can rename them without breaking callers. The names of the kwargs can be considered "external" and the names of the positional args remain private to the function.
This gives authors flexibility to rename args, or even convert all the positional args to variadic `*args`, without affecting users.
It also gives authors control over argument order. Like you write `def pow(x, y)`, conventionally meaning "x to the power y", and you don't want users to call it like `pow(y=2, x=3)`.