PyArg_ParseTuple() and oprtional remaining argument lists
Adrian Eyre
a.eyre at optichrome.com
Mon Nov 29 08:50:22 EST 1999
> I also have trouble using PyArg_ParseTuple(...) with a single item,
> e.g.
> if (PyArg_Parse(args,"i",&index) && (index >= 0)) {
> is ok, but
> if (PyArg_ParseTuple(args,"i",&index) && (index >= 0)) {
Aha. That's the clue. Make sure that your PyMethodDef struct is like
this:
static struct PyMethodDef methods[] = {
{ "method1", method1, 1 },
{ "method2", method2, 1 },
{ NULL, NULL, 0 }
};
Not like this:
static struct PyMethodDef methods[] = {
{ "method1", method1 },
{ "method2", method2 },
{ NULL, NULL }
};
--------------------------------------------
Adrian Eyre <mailto:a.eyre at optichrome.com>
Optichrome Computer Solutions Ltd
Maybury Road, Woking, Surrey, GU21 5HX, UK
Tel: +44 1483 740 233 Fax: +44 1483 760 644
http://www.optichrome.com
--------------------------------------------
More information about the Python-list
mailing list