function arguments

Neel Krishnaswami neelk at brick.cswv.com
Thu Jul 6 18:08:21 EDT 2000


Johannes Zellner <johannes at zellner.org> wrote:
> 
> Hello,
> 
> is there a way to get a functions argument list ?
> 
> e.g.
> 
> def fun(fred, lola):
>     ...
> 
> something like `arglist(fun)' should return [ 'fred', 'lola' ]

Sure -- use my Signature module:

  >>> import Signature
  >>> def fun(fred, lola):
  ...     pass
  ... 
  >>> s = Signature.Signature(fun)
  >>> s.full_arglist()
  ['fred', 'lola']

It's at <URI:http://www.sff.net/people/neelk/open-source/> -- let me
know what you think. The big limitation is that it won't work on C
builtins -- but all functions and methods written in Python should
work, including callable objects using a __call__ method.


Neel



More information about the Python-list mailing list