PyArg_ParseTupleAndKeywords

MRAB python at mrabarnett.plus.com
Sat Jan 23 14:14:54 EST 2010


Mr.M wrote:
> MRAB ha scritto:
> 
>> Did you specify that the method accepts keywords arguments with
>> METH_KEYWORDS? The function would take parameters for the instance
>> (self), the positional arguments (args) and the keyword arguments
>> (kwargs).
>>
>> http://docs.python.org/c-api/structures.html
>>
>> If you don't use METH_KEYWORDS then it'll think that all the arguments
>> are positional, which is what seems to be happening:
>>
> 
> Thank you MRAB for your reply.
> No, i didn't specify METH_KEYWORDS flag, but i think init method (the 
> one that you put in tp_init slot, it is "initproc" type) doesn't have to 
> appear in the PyMethodDef structure.
> 
> Maybe i'm wrong?
> 
I think you're right.




More information about the Python-list mailing list