Names of function's args?

Michael Hudson mwh at python.net
Tue Jan 29 16:13:00 CET 2002


"vigasinus" <vi at rial.net> writes:

> --- In python-list at y..., Michael Hudson <mwh at p...> wrote:
> 
> > > Hello, All
> 
> > > ....
> > > How to get them outside of a function?
> 
> > f.func_code.co_varnames[:f.func_code.co_argcount]
> > 
> > Is that what you meant?
> Yes. Great thanks for your answer!

Pleasure.  Remember to watch for *- and **-style arguments; examine
the func_code.co_flags to see if they're present (I'm afraid I can't
remember whether they're included in co_argcount -- I don't think so).

Cheers,
M.

-- 
 "Sturgeon's Law (90% of everything is crap) applies to Usenet."
 "Nothing guarantees that the 10% isn't crap, too."
                -- Gene Spafford's Axiom #2 of Usenet, and a corollary



More information about the Python-list mailing list