PyArg_ParseTupleAndKeywords in Python3.1
Emeka
emekamicro at gmail.com
Sat Dec 19 05:36:59 EST 2009
Okay if that is the case, why do we need it? By having int a = 65, b = 66 ,
why should we also have *kwlist[]?
static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
{
int a=65, b=66;
char *kwlist[] = {"a", "b", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC", kwlist, &a,
&b))
return NULL;
return Py_BuildValue("(CC)", a, b);
}
On Fri, Dec 18, 2009 at 9:31 PM, casevh <casevh at gmail.com> wrote:
> On Dec 18, 10:28 am, Joachim Dahl <dahl.joac... at gmail.com> wrote:
> > My mistake seems to be that I declared
> >
> > char a, b;
> >
> > instead of
> >
> > int a, b;
> >
> > Thank you for sorting this out.
> >
> > Joachim
>
> I think you need to initialize them, too.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091219/0a29ec58/attachment-0001.html>
More information about the Python-list
mailing list