Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python get number of arguments of a function

from inspect import signature

def someMethod(self, arg1, kwarg1=None):
    pass

sig = signature(someMethod)
print(len(sig.parameters))  # 3
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #number #arguments #function
ADD COMMENT
Topic
Name
4+6 =