introspection and functions

Ricardo Aráoz ricaraoz at gmail.com
Thu Aug 23 11:02:16 EDT 2007


Ayaz Ahmed Khan wrote:
> "James Stroud" typed:
>> py> def doit(a, b, c, x=14):
>> ...   pass
>> ...
>> py> doit.func_code.co_argcount
>> 4
>> py> doit.func_code.co_varnames
>> ('a', 'b', 'c', 'x')
>> py> doit.func_defaults
>> (14,)
> 
> Neat.
> 

How do you know the 14 corresponds to x ?





More information about the Python-list mailing list