On 2/24/2015 8:56 PM, Gregory P. Smith wrote: > inspect.getargspec(method) and inspect.signature(method) both include > the 'self' parameter but how are we to figure out from method itself > that it is actually bound and that its first parameter is expected to be > a bound instance? This seems like a python-list question. > So far I've come up with: > /inspect.ismethod(method) or inspect.ismethoddescriptor(method)/ > > But that is still not quite right as it remains False in 3.4 for the > simple case of: > > >>> class A: > ... def x(self): > ... pass > ... > >>> inspect.ismethod(A.x) > False > >>> inspect.ismethoddescriptor(A.x) > False These are correct. A.x is the function resulting from execution of the def statement. >>> type(A.x) <class 'function'> This is different from 2.x. If you call the function as a function, there is no requirement on its argument, and no binding. >>> A.x(3) # returns None >>> -- Terry Jan Reedy
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