From: Joachim Dahl on 18 Dec 2009 13:28 My mistake seems to be that I declared char a, b; instead of int a, b; Thank you for sorting this out. Joachim
From: casevh on 18 Dec 2009 16:31 On Dec 18, 10:28 am, Joachim Dahl <dahl.joac...(a)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.
From: Gabriel Genellina on 21 Dec 2009 02:35 En Sat, 19 Dec 2009 07:36:59 -0300, Emeka <emekamicro(a)gmail.com> escribi�: > 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); > } It's not related to default values. foo(x=30) should raise an error; the allowed parameter names are only 'a' and 'b', not 'x'. -- Gabriel Genellina
First
|
Prev
|
Pages: 1 2 3 Prev: Python PIL and Vista/Windows 7 .. show() not working ... Next: can you say it please |