[Cython] dict set value

Robert Bradshaw robertwb at math.washington.edu
Thu Sep 4 23:39:21 CEST 2008


On Fri, 5 Sep 2008, Max Ivanov wrote:

> Hi all!
>
> I'm new to Cython, but I'm really impressed by this product, thx to
> all developers it look really great.

Thanks.

> My first newbie question following.
>
> Do I do something wrong here:
> ---------
> cdef dict a
> a = {}
> a['a'] = 1
> ----------
>
> it still generates inefficient code via PyObject, not via PyDict_SetItem:
>
> PyObject_SetItem(((PyObject *)__pyx_v_1a_a), __pyx_kp_1, __pyx_int_1)

No, this simply hasn't been implemented yet. In this specific case there 
isn't going to be a huge speedup (though there will be some).

- Robert


More information about the Cython-dev mailing list