runtime-info about a function-object

Andreas Leitgeb Andreas.Leitgeb at siemens.at
Mon Aug 19 14:39:39 EDT 2002


Michael Hudson <mwh at python.net> wrote:
> Andreas.Leitgeb at siemens.at (Andreas Leitgeb) writes:
>> >>> def f(x,y,z=someobj,*arg,**dict): pass
>> 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).

Thanks a lot !
 ... especially getargspec(f) pleased me :-)

Thanks also to Mark McEahern, for pointing out  f.func_code.*,
  the primary source of information.

-- 
Newsflash: Sproingy made it to the ground !
  read more ... <http://avl.enemy.org/sproingy/>



More information about the Python-list mailing list