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 "", line 1, in 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: formatargspec(*getargspec(f)) Or better: formatargspec(*getfullargspec(f)) Try with: def f(a: int, b: float): pass