Comment 1 for bug 206828

Revision history for this message
robertwb (robertwb) wrote : Re: [Bug 206828] [NEW] cannot use keyword for single required argument

This is an efficiency issue (Python has special (faster) calling
conventions for one-argument methods). Many of the builtin object
methods don't take keywords either. Perhaps we can make an option
that allows keywords arguments for one-argument methods (although I
don't have a specific case in mind why one would want to use them).

- Robert

On Mar 25, 2008, at 2:58 PM, Felix Wu wrote:

> Public bug reported:
>
> For methods taking a single required argument, the code generated does
> not allow one to use keyword to pass the argument. This happens in
> both
> 0.9.6.11b and 0.9.6.12.
>
> For example, a method like the following
>
> def setOptObject(self, obj):
> self._obj = obj
>
> generates the code below, which clearly cannot handle keyword
> argument:
>
> static PyObject *__pyx_pf_1t_7pyCTest_setOptObject(PyObject
> *__pyx_v_self, PyObject *__pyx_v_obj) {
> PyObject *__pyx_r;
> Py_INCREF(__pyx_v_self);
> Py_INCREF(__pyx_v_obj);
> Py_INCREF(__pyx_v_obj);
> Py_DECREF(((struct yCTest *)__pyx_v_self)->_obj);
> ((struct yCTest *)__pyx_v_self)->_obj = __pyx_v_obj;
>
> __pyx_r = Py_None; Py_INCREF(Py_None);
> Py_DECREF(__pyx_v_self);
> Py_DECREF(__pyx_v_obj);
> return __pyx_r;
> }
>
> ** Affects: cython
> Importance: Undecided
> Status: New
>
> --
> cannot use keyword for single required argument
> https://bugs.launchpad.net/bugs/206828
> You received this bug notification because you are a member of Cython-
> dev, which is subscribed to Cython.