En Sat, 19 Dec 2009 07:36:59 -0300, Emeka 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}
My mistake seems to be that I declared
char a, b;
instead of
int a, b;
Thank you for sorting this out.
Joachim
--
http://mail.python.org/mailman/listinfo/python-list
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",
On Dec 18, 10:28 am, Joachim Dahl 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
On Fri, Dec 18, 2009 at 7:57 AM, Emeka wrote:
> Case,
> Thanks so much! However, I am still confused. This is what I understood;
> foo (a = "a", b = "b") so function , foo, has default values which are "a"
> and "b". pointer kwlist[] is a way of specifying default values .
> Regards,
> Emeka
kwli
Case,
Thanks so much! However, I am still confused. This is what I understood;
foo (a = "a", b = "b") so function , foo, has default values which are "a"
and "b". pointer kwlist[] is a way of specifying default values .
Regards,
Emeka
On Fri, Dec 18, 2009 at 3:02 PM, Case Vanhorsen wrote:
>
On Fri, Dec 18, 2009 at 2:26 AM, Emeka wrote:
> char *kwlist[] = {"a", "b", NULL};
> if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC", kwlist, &a,
> &b))
> I am yet to understand what pointer kwlist[] does and why it is needed?
> Regards,
> Emeka
foo is designed to accept two arguments t
char *kwlist[] = {"a", "b", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC", kwlist, &a,
&b))
I am yet to understand what pointer kwlist[] does and why it is needed?
Regards,
Emeka
On Fri, Dec 18, 2009 at 8:17 AM, casevh wrote:
> On Dec 17, 11:14 am, Joachim Dahl wrote:
> > In
static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
{
int a=65, b=66;
char *kwlist[] = {"a", "b", NULL};
I am yet to understand what kwlist pointer does and why it is needed?
if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC", kwlist, &a,
&b))
return NULL;
re
On Dec 17, 11:14 am, Joachim Dahl wrote:
> In the Ubuntu 9.10 version of Python 3.1 (using your patch), there's a
> related bug:
>
> >>> foo(b='b')
>
> will set the value of a in the extension module to zero, thus clearing
> whatever
> default value it may have had. In other words, the optional c
In the Ubuntu 9.10 version of Python 3.1 (using your patch), there's a
related bug:
>>> foo(b='b')
will set the value of a in the extension module to zero, thus clearing
whatever
default value it may have had. In other words, the optional character
arguments
that are skipped seem to be nulled by
thanks - the patch fixed my problem.
Joachim
On Dec 1, 5:51 am, casevh wrote:
> On Nov 30, 2:18 pm, Joachim Dahl wrote:
>
>
>
>
>
> > I think that "C" encoding is what I need, however I run into an odd
> > problem.
> > If I use the following C code
>
> > static PyObject* foo(PyObject *self, PyO
On Nov 30, 2:18 pm, Joachim Dahl wrote:
> I think that "C" encoding is what I need, however I run into an odd
> problem.
> If I use the following C code
>
> static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
> {
> char a, b;
> char *kwlist[] = {"a", "b", NULL};
> if (!PyAr
I think that "C" encoding is what I need, however I run into an odd
problem.
If I use the following C code
static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
{
char a, b;
char *kwlist[] = {"a", "b", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC", kwlist, &a,
&b
On Nov 30, 1:04 pm, Joachim Dahl wrote:
> Obviously the name of the C function and the char variable cannot both
> be foo,
> so the C code should be:
>
> static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
> {
> char foochar;
> char *kwlist[] = {"foochar", NULL};
> if (!PyA
Obviously the name of the C function and the char variable cannot both
be foo,
so the C code should be:
static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
{
char foochar;
char *kwlist[] = {"foochar", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwrds, "c", kwlist,
&foocha
I am updating an extension module from Python2.6 to Python3.
I used to pass character codes to the extension module, for example, I
would write:
>>> foo('X')
with the corresponding C extension routine defined as follows:
static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds)
{
ch
17 matches
Mail list logo