Re: introspection and functions

2007-08-23 Thread Wildemar Wildenburger
Ricardo Aráoz wrote: > 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. >

Re: introspection and functions

2007-08-23 Thread Ricardo Aráoz
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 ? -- http

Re: introspection and functions

2007-08-22 Thread Ayaz Ahmed Khan
"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. -- Ayaz Ahmed Khan I have not yet begun to byte! -- http://mail.python.org/mailman/listinf

Re: introspection and functions

2007-08-22 Thread Scott David Daniels
yagyala wrote: > Hi. I would like to be able to tell, at run time, how many parameters > a function requires. Ideally I would like to be able to tell which are > optional as well. I've tried looking at the functions attributes, but > haven't found one that helps in this. How can I do this? > > Tha

Re: introspection and functions

2007-08-22 Thread Bruno Desthuilliers
yagyala a écrit : > Hi. I would like to be able to tell, at run time, how many parameters > a function requires. Ideally I would like to be able to tell which are > optional as well. I've tried looking at the functions attributes, but > haven't found one that helps in this. How can I do this? >>>

Re: introspection and functions

2007-08-22 Thread James Stroud
yagyala wrote: > Hi. I would like to be able to tell, at run time, how many parameters > a function requires. Ideally I would like to be able to tell which are > optional as well. I've tried looking at the functions attributes, but > haven't found one that helps in this. How can I do this? > > Tha

Re: introspection and functions

2007-08-22 Thread Wildemar Wildenburger
yagyala wrote: > Hi. I would like to be able to tell, at run time, how many parameters > a function requires. Ideally I would like to be able to tell which are > optional as well. I've tried looking at the functions attributes, but > haven't found one that helps in this. How can I do this? > I'v