Hello :)This is my first mail here, I had an idea that I'd like to propose. The `getargspec` function in the `inspect` module enforces the input parameter to be either a method or a function. def getargspec(func): """Get the names and default values of a function's arguments. A tuple of four things is returned: (args, varargs, varkw, defaults). 'args' is a list of the argument names (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'defaults' is an n-tuple of the default values of the last n arguments. """ if ismethod(func): func = func.im_func if not isfunction(func): raise TypeError('{!r} is not a Python function'.format(func)) args, varargs, varkw = getargs(func.func_code) return ArgSpec(args, varargs, varkw, func.func_defaults) Passing in a callable which is not a function causes a TypeError to be raised. I think in this case any callable should be allowed, allowing classes and callable objects as well.We can switch on whether `func` is a function, a class or a callable object, and pass into `getargs` the appropriate value. What is your opinion?Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160116/134762c6/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4