runtime-info about a function-object

Michael Hudson mwh at python.net
Mon Aug 19 12:33:09 EDT 2002


Andreas.Leitgeb at siemens.at (Andreas Leitgeb) writes:

> >>> def f(x,y,z=someobj,*arg,**dict): pass
> ...
> >>> f
> <function f at 0x8167bb4>
> 
> Is it possible to request info about function-object "f",
>  especially about the number/name/defaults of arguments
>  that f accepts ?

Yes, the inspect module can do this.  I suggest you read it's
documentation (see python.org).

Cheers,
M.

-- 
  Make this IDLE version 0.8.  (We have to skip 0.7 because that 
  was a CNRI release in a corner of the basement of a government 
  building on a planet circling Aldebaran.)
                             -- Guido Van Rossum, in a checkin comment



More information about the Python-list mailing list