-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Labels
SciPEPSciPy Enhancement ProposalSciPy Enhancement ProposaldeprecatedItems related to behavior that has been deprecatedItems related to behavior that has been deprecated
Description
Is your feature request related to a problem? Please describe.
Keywords only arguments are arguably clearer and allow easier refactoring on our side. When adding a new feature, we are already thinking about using *
to declare keyword only arguments.
Describe the solution you'd like.
scikit-learn
already went through this process and with their v1 coming up, the whole code base is already keywords-only arguments. Hence, if accepted, I propose we follow the same path.
They did it in two phases:
- Deprecation phase with a wrapper: it takes a function and look at which arguments are keywords only. If you call the function using a positional argument instead of a keyword only argument (if
f(a, *, b)
and you dof(1, 2)
instead off(1, b=2)
) then it will raise a deprecation warning. The function will still be working as the keyword arguments would not be enforced yet. The wrapper will convert the positional argument into a keyword argument. - Remove the wrapper: after the deprecation cycle, remove the wrapper and we are done.
Metadata
Metadata
Assignees
Labels
SciPEPSciPy Enhancement ProposalSciPy Enhancement ProposaldeprecatedItems related to behavior that has been deprecatedItems related to behavior that has been deprecated