refactor: standardize use of keyword/positional-only arguments #9125
Labels
breaking change
Changes that introduce an API break at any level
refactor
Issues or PRs related to refactoring the codebase
Python 3.8+ supports both keyword-only and positional-only arguments. We might want to survey our existing APIs and try to consistently make use of positional and keyword-only arguments in cases where they make sense.
They main way this would show up as an improvement is making it easier for us to refactor internals without making things a (potentially) breaking change for users. Say we had an existing function:
With this, users can call this in a few different formats:
Allowing these different calling conventions makes amending this API trickier. We have to worry about adding new keyword arguments only at the end, and never renaming any of the positional arguments (since the user may have called them by name). Moving to a stricter positional-only/keyword-only subset would mean that:
The text was updated successfully, but these errors were encountered: