On Wed, 08 Jun 2005 08:35:39 -0400, Kent Johnson wrote:
>> How can I query the function object foo to know the number of parameters
>> it expects. I can find it is a function using callable(f), I can find
>> some information (listed by dir(foo)) such as the name of the
>> function,etc.. but no
Kent Johnson a écrit :
> Xavier Décoret wrote:
>
>> Hello,
>>
>> I have the following code:
>>
>> def foo(x,y):
>> pass
>>
>> How can I query the function object foo to know the number of
>> parameters it expects. I can find it is a function using callable(f),
>> I can find some information
Xavier Décoret wrote:
> Hello,
>
> I have the following code:
>
> def foo(x,y):
> pass
>
> How can I query the function object foo to know the number of parameters
> it expects. I can find it is a function using callable(f), I can find
> some information (listed by dir(foo)) such as the n
Use the inspect module like:
>>> def tf( a, b, c, *arguments, **keywordArguments ):
... print "tf"
...
>>> import inspect
>>> inspect.getargspec( tf )
(['a', 'b', 'c'], 'arguments', 'keywordArguments', None)
>>>
Xavier Décoret schrieb:
> Hello,
>
> I have the following code:
>
> def foo(x,