get function arguments

Terry Hancock hancock at anansispaceworks.com
Fri Nov 19 22:05:13 EST 2004


On Tuesday 16 November 2004 02:03 pm, Steven Bethard wrote:
> 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

They're not easy to find, I'll grant you. But this table is pretty
interesting:

http://python.org/doc/2.3.4/lib/inspect-types.html

OTOH, this probably *shouldn't* be too easy to find, as it's not
something you should use until you really *really* need it.

Cheers,
Terry

ziur(--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list