Python inspect.getargspec со встроенной функцией
Я пытаюсь выяснить аргументы метода, извлеченного из модуля.
Я нашелinspect
модуль с удобной функцией,getargspec
.
It works for a function that I define, but won't work for functions from an imported module.
import math, inspect
def foobar(a,b=11): pass
inspect.getargspec(foobar) # this works
inspect.getargspec(math.sin) # this doesn't
Я получу ошибку, подобную этой:
File "C:\...\Python 2.5\Lib\inspect.py", line 743, in getargspec
raise TypeError('arg is not a Python function')
TypeError: arg is not a Python function
Являетсяinspect.getargspec
предназначен только для локальных функций или я что-то не так делаю?