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?

You can do

   a[0], a[1], a[2], a[3], a[4] = 1, 3, 28, 5, 3

which will get turned into a series of assignments.

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,
that will only work if a is a Python sequence (or possibly
a numpy array, although I'm not sure how efficient it will
be in that case).

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

Reply via email to