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
Add example for inspect module doc #60447
Comments
In Python 3.3.0 and 3.2.3: >>> from inspect import *
>>> def f(a,b):pass
...
>>> formatargspec(getargspec(f))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/inspect.py", line 905, in formatargspec
spec = formatargandannotation(arg)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/inspect.py", line 898, in formatargandannotation
if arg in annotations:
TypeError: unhashable type: 'list' No such error in 2.7.1: >>> formatargspec(getargspec(f))
'((a, b), None, None, None)' |
It looks like a typo in your code. You should use instead: Or better: Try with: |
My bad, but I think documentation can be improved by adding an example. |
Here's a patch that adds an example of using |
New changeset 9d3b616fc702 by Andrew Svetlov in branch '3.3': New changeset a0337031a6b7 by Andrew Svetlov in branch 'default': |
Thanks, Berker. |
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: