yagyala a écrit :
> Hi. I would like to be able to tell, at run time, how many parameters
> a function requires. Ideally I would like to be able to tell which are
> optional as well. I've tried looking at the functions attributes, but
> haven't found one that helps in this. How can I do this?

 >>> def myfunc(arg1, arg2, arg3='toto', *args, **kw): pass
...
 >>> import inspect
 >>> inspect.getargspec(myfunc)
(['arg1', 'arg2', 'arg3'], 'args', 'kw', ('toto',))


HTH
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to