Hi,

Robert Bradshaw wrote:
>>> The main idea (Lisandro came up with this) is to build these
>>> capabilities into cython itself by introducing the following syntax:
>>>
>>> cdef foo(size):
>>>   cdef double a[size]    # This is like the dynamic arrays in C99
>>>   # do stuff with a, but don't worry about deallocating the memory!!!
[...]
> and coerce it too (or from?) a Python object.

I find that a funny idea. We could generate an internal array iterator class
that yields the coerced Python values in order, so that "list(a)" would work. :)


>> 3) Long-term Python users with very little C experience might end up
>> doing something like
>>
>> cdef double a[size]
>> # fill in a
>> return a
> 
> If the return type is double*, an error can be given at compile time,  
> and if it's object it could even coerce to a Python list. I would say  
> a can neither be assigned to or used as an assignment to something  
> else--just indexed.

Exactly. It's not a pointer, it's an array.

Stefan

_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to