Get inline method signature - Python

How to get the signature of inline methods? Example: dict (). Get (k)

>> a = dict().get >> a <built-in method get of dict object at 0x1003aafd0> >> a.__doc__ 'D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.' >> import inspect >> inspect.getargspec(a) TypeError: <built-in method get of dict object at 0x100377250> is not a Python function 

I would like to see a result like this

 >> a.some_function() ('key', 'default'=None) 
+7
source share
1 answer

I do not think this is possible for built-in functions in python that are implemented in C. See this discussion of errors for further details.

+4
source

All Articles