yagyala wrote: > 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? > > Thanks > This really only will work for those functions that are simply constructed. You are better off not trying to do this, or code like the following will confound your code:
from functools import partial def somefunction(a=23, b=14, c='hi'): print 'Finally' f = partial(somefunction, b=13) g = partial(f, a=19) h = partial(g, c=123) print whatargs(h) -- http://mail.python.org/mailman/listinfo/python-list