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

Raise the deprecation warning for args (besides kwargs) #16

Open
loicvh opened this issue Jan 24, 2024 · 1 comment
Open

Raise the deprecation warning for args (besides kwargs) #16

loicvh opened this issue Jan 24, 2024 · 1 comment

Comments

@loicvh
Copy link

loicvh commented Jan 24, 2024

Currently the deprecation warning is only shown for kwargs. I think that doing the same for args would be interesting (either by config or by default).

@deprecat(deprecated_args={'a':{'version':'4.0', 'reason': ''}, 'b':{'version':'3.0',  'reason': ''}})
def multiply(a, b, c):
    return 42
    
multiply(1,2,3)
multiply(a=1,b=2,c=3)

Wouldn't it be more consistent to display the deprecation at the first call? The deprecated args have actually been called. Currently the output is

>>> multiply(1,2,3)
42
>>> multiply(a=1,b=2,c=3)
<stdin>:1: DeprecationWarning: Call to deprecated Parameter a. -- Deprecated since v4.0.
<stdin>:1: DeprecationWarning: Call to deprecated Parameter b. -- Deprecated since v3.0.
42

@SpacemanPaul
Copy link
Collaborator

I'm not 100% sure that's even possible given the Python argument resolution works.

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

2 participants