가능한 중복 계산 :
How to find out the arity of a method in Python파이썬 함수 매개 변수
는 파이썬 기능을 감안할 때, 어떻게 프로그래밍 걸리는 매개 변수의 수를 결정합니까를?
가능한 중복 계산 :
How to find out the arity of a method in Python파이썬 함수 매개 변수
는 파이썬 기능을 감안할 때, 어떻게 프로그래밍 걸리는 매개 변수의 수를 결정합니까를?
이 검사 http://docs.python.org/library/inspect.html#inspect.getargspec는 inspect.getargspec(func) 명령을 살펴보십시오이 경우
>>> def testFunc(arg1, arg2, arg3, additional='test'):
... print arg1
...
>>> import inspect
>>> inspect.getargspec(testFunc)
ArgSpec(args=['arg1', 'arg2', 'arg3', 'additional'], varargs=None, keywords=None, defaults=('test',))
>>>
함수 외부에서, 당신은) (inspect.getargspec 사용할 수 있습니다
에있는 당신의 친구입니다. 이것은 튜플을 제공하는데, 첫 번째 요소는 필수 매개 변수 목록입니다.
가능한 복제본 : http://stackoverflow.com/questions/990016/how-to-find-out-the-arity-of-a-method-in-python, http://stackoverflow.com/questions/ 3913963/python-arguments-of-python-function/3915056 # 3915056 – mouad