Greg Ewing wrote:
> jay wrote:
>> I want declare an array with a shape at the beginning of program,then
>> in my function i will assign value to it by calculation.
>> Is there a good way to do it?
>
> Ideally, what you *should* be able to do is
>
> a[:] = 1, 3, 28, 5, 3
>
> but unless Cython has grown a feature I don't know about,
As I said, this works already:
cdef int* a = [1, 3, 28, 5, 3]
However, a later assignment will not work. Your example above is
absolutely the way to go, and it would even work in the case where a is
declared as a plain pointer, not just a fixed size array.
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev