Finding a function's parameters in Python
问题 I want to be able to ask a class's __init__ method what it's parameters are. The straightforward approach is the following: cls.__init__.__func__.__code__.co_varnames[:code.co_argcount] However, that won't work if the class has any decorators. It will give the parameter list for the function returned by the decorator. I want to get down to the original __init__ method and get those original parameters. In the case of a decorator, the decorator function is going to be found in the closure of