get function arguments

Steven Bethard steven.bethard at gmail.com
Tue Nov 16 15:03:53 EST 2004


Benny Mohr <news5 <at> bennymo.ch> writes:
> 
> How can I get the list of argumens of this function?

Is this what you mean?

>>> def myFunc(a,b,c='default'):
... 	pass
... 
>>> myFunc.func_code.co_varnames
('a', 'b', 'c')

I don't know where (if?) the func_code attributes are documented, but you should
be able to figure them out with a little object introspection (e.g. dir or an
editor like PythonWin that does some code completion).

Steve




More information about the Python-list mailing list