PyArg_ParseTuple, test for SEVERAL possibilities

Torsten Mohr tmohr at s.netic.de
Mon Jun 7 16:22:39 EDT 2004


Hi,

i'd like to write an extension module and use
PyArg_ParseTuple in that to parse the parameters.

I have several questions related to this that i did
not find in the documentation:

1. I'd like to check for a list of "int"s and i don't
know how many int's are in this array, it could be
0 to 8, all of this would make sense.

How can i check for that?


2. I'd like to check for SEVERAL possibilities of
argument string, e.g. for "sss" and "li" and "[3]".
How can i do that without error message when the
parameters do not match?


3. Not really related to ParseTuple, but to BuildValue:
I want to create a list as a return value.  I want to
create the size of that list at runtime.
For example if i want to return a list with up to
200 values, how can i build that at runtime?


I'm sorry if i missed something, but i read the documentation
and googled for it.  But sadly no results...


Best regards,
Torsten.





More information about the Python-list mailing list