Finding Function Args?

Mike C. Fletcher mcfletch at rogers.com
Mon Jun 14 22:40:13 EDT 2004


Check the standard module inspect, particularly;

 >>> import inspect
 >>> import cgi
 >>> inspect.getargspec( cgi.escape )
(['s', 'quote'], None, None, (None,))


HTH,
Mike

Chris S. wrote:

> Is there a way to dynamically find out how many arguments a function 
> requires? I thought this would be listed somewhere with dir() but I 
> can't find anything. Any help is appreciated.

________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/
  blog: http://zope.vex.net/~mcfletch/plumbing/





More information about the Python-list mailing list