getting argument names from a function

gbreed at gbreed at
Tue Jul 10 12:44:15 EDT 2001

In article <6%F27.4784$yh2.453987 at>, dan at 
(dan) wrote:

> def aFunction(arg1, arg2):
>    print arg1, arg2
> is there a way I can get to the arguments of aFunction (i.e. 'arg1' and 
> 'arg2')?
> I've tried dir(..) on the function object and subsequent object and 
> can't find what I'm looking for. Is it possible to do what I want?

aFunction.func_code.co_names seems to do the trick


More information about the Python-list mailing list