On Nov 7, 2008, at 1:14 AM, Stefan Behnel wrote:

> Hi,
>
> zhen_qing_he_456 wrote:
>>      if in my fuction i declare a c array like:
>>                cdef  int a[5]
>>      now if want to initialize my array a, i can do follow:
>>         a[0] = 1
>>         a[1] = 10
>>            :
>>           :
>>         a[4] = 3
>>      the value to my array is not continuous. Is there a quicker  
>> way in Cython  to do it like in c:
>>            a[5] = {1,3,28,5,3}
>
> In the current Cython release candidate
>
> http://cython.org/Cython-0.10.rc.tar.gz
>
> you can do
>
>       def test():
>           cdef int* a = [1,2,3,4,5]
>           print a[0]
>
> Apparently, this currently only works inside functions, but that  
> should be
> fixable.

Hmm... it worked before the "assignment on declaration" restriction.  
http://trac.cython.org/cython_trac/ticket/113

- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to