Skip to content
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

Replacement parameters #21

Open
3 tasks
Julian opened this issue Aug 15, 2020 · 0 comments
Open
3 tasks

Replacement parameters #21

Julian opened this issue Aug 15, 2020 · 0 comments

Comments

@Julian
Copy link
Owner

Julian commented Aug 15, 2020

It should be possible to (somehow) specify simple cases of parameter replacement. Say, 1-to-1 or n-to-1 parameter replacements in which 1 (or multiple) parameters are replaced by 1 new replacement parameter.

The parameter deprecation call should allow specifying:

  • which parameter is the replacement
  • that passing both should be an exception (and default to raising one)
  • an optional "transformation" to apply to the argument passed into the deprecated parameter which either:
    • converts the old argument into one for the new replacement (e.g. lambda old_value: _from_legacy(old_value) would pass the upconverted value into the new replacement parameter).
    • passes the old argument through as-is (and thereby simply raises the deprecation warning)
    • drops the argument entirely (i.e. ignores the old argument entirely. The advantage is that the call signature of the wrapped function can already remove the deprecated parameter, making its deletion slightly easier.)

(The deprecation message should then also list the replacement parameter, as it does for regret.callable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant