I\'m looking for a way to check the number of arguments that a given function takes in Python. The purpose is to achieve a more robust method of patching my classes for tests.
You can use:
import inspect len(inspect.getargspec(foo_func)[0])
This won't acknowledge variable-length parameters, like:
def foo(a, b, *args, **kwargs): pass