-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
inspect.getcallargs() #47385
Comments
I'd like to propose a new function for inclusion to the inspect module >>> def func(a, b='foo', c=None, *x, **y):
... pass
>>> sorted(getcallargs(func, 5, z=3, b=2).items())
[('a', 5), ('b', 2), ('c', None), ('x', ()), ('y', {'z': 3})] This is handy when writing decorators, or more generally when one would I have posted a recipe at |
I updated the recipe to also return a |
Also updated url: http://code.activestate.com/recipes/551779/ |
I reverted the function to the original API (return just the dict with the bindings), cleaned it up, wrote thorough unit tests and made a patch against Python 2.7a4. |
Renamed the Testcase classes to conform with the rest in test_inspect.py, added a few more tests for tuple args and patched against the latest trunk (r79086). |
The patch will also need docs in inspect.rst. |
|
Would you upload this patch to Rietveld for review? |
Uploaded at http://codereview.appspot.com/659041/show |
Applied in r79500. Note I removed the error checking that a bound method received an instance of the class as the first argument because that error checking is a function of the calling of the function, not the binding of the arguments. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: