views:

150

answers:

2

From method name I would like know its signature

i.e.

def myMethod(firt, second, third='something'):
    pass

from myMethod name is possible have samenthig like that

 myMethod(firt, second, third='something')
A: 

Try calling help on an object to find out about it.

>>> foo = [1, 2, 3]
>>> help(foo.append)
Help on built-in function append:

append(...)
    L.append(object) -- append object to end
Mike Graham
+8  A: 
import inspect

def foo(a,b,x='blah'):
    pass

print(inspect.getargspec(foo))
# ArgSpec(args=['a', 'b', 'x'], varargs=None, keywords=None, defaults=('blah',))
unutbu
AttributeError: 'module' object has no attribute 'getargspec'
Spì
@Spi, you are calling `inspect.getargspec` on a module, not a function.
Mike Graham
Thanks, the problem was with Eclipse that did not see the inspect module
Spì