-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating to keyword only arguments #2130
Comments
|
I had a quick skim through https://hypothesis.readthedocs.io/en/latest/data.html All look good to go with keyword only arguments, save |
|
Sounds great! I'd apply the "defaults = kwonly" principle to everything, not just strategies, and use I've also been looking at refactoring tools that would let us ship an upgrade script to automatically fix any uses. Nothing specific yet, but the principle would be great ("automatically upgrade any automatically fixable deprecation"). We'll see. As an exception to the "has default = kwonly" principle, I'd argue that for numeric strategies |
|
scikit-learn is doing something similar, and reading their proposal made me realise that it's easier to define the function with real kwonly arguments and have the decorator create the compat form than vice-versa. |
Keyword only arguments are lovely and with the upcoming dropping of Python 2 support (😻 😻 😻 ) we can start actually using them in our APIs.
My proposed plan:
realname_deprecated. This emits a deprecation warning but otherwise does the right thing. We can handle this essentially transparently with a decorator.Because we do all of this backwards compatibly we don't need to (and shouldn't) do this in Hypothesis 4.0, which can be a pure deprecation release, but it would be nice to have the details of the plan fully fleshes out by the time 4.0 lands so we can do it soon afterwards.
It would be particularly good to note any exceptions where we shouldn't have arguments as keyword only.
The text was updated successfully, but these errors were encountered: