[Cython] [cython-users] Recommendations for efficient typed arrays in Cython?

Sturla Molden sturla at molden.no
Mon Feb 4 13:12:56 CET 2013


On 02.02.2013 01:23, Greg Ewing wrote:

> If you're suggesting that 'def object foo' should give Python
> reference semantics and 'cdef object foo' raw C pointer
> semantics,

No I was not.

I was suggesting that static declarations of Python and C variables 
should have different keywords.

Because they behave differently e.g. with respect to reference counting, 
it can be confusing to new users. For example I was replying to a Cython 
user who thought anything declared 'cdef' was reference counted. It 
might not be obvious to a new Cython user what can be put in a Python 
list and what can be put in an STL vector.

"cdef" refers to storage in the generated C, not to the semantics of 
Cython. But how and where variables are stored in the generated C is an 
implementation detail. Semantically the difference is between static and 
dynamic variables.


Sturla





More information about the cython-devel mailing list