Python inspect.getargspec with built-in function

前端 未结 2 1461
天命终不由人
天命终不由人 2020-12-19 08:16

I\'m trying to figure out the arguments of a method retrieved from a module. I found an inspect module with a handy function, getargspec. It works

2条回答
  •  遥遥无期
    2020-12-19 08:45

    It is impossible to get this kind of information for a function that is implemented in C instead of Python.

    The reason for this is that there is no way to find out what arguments the method accepts except by parsing the (free-form) docstring since arguments are passed in a (somewhat) getarg-like way - i.e. it's impossible to find out what arguments it accepts without actually executing the function.

提交回复
热议问题