getting argument names from a function

gbreed at cix.compulink.co.uk gbreed at cix.compulink.co.uk
Tue Jul 10 18:44:15 CEST 2001


In article <6%F27.4784$yh2.453987 at weber.videotron.net>, dan at eevolved.com 
(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


              Graham




More information about the Python-list mailing list