[Pyrex] Initialisation of cdef global arrays with
constants [resend]
sjmachin at lexicon.net
sjmachin at lexicon.net
Sat Jan 8 23:56:45 CET 2005
On 8 Jan 2005 at 0:01, Yann Vernier wrote:
> On Sat, Jan 08, 2005 at 07:01:21AM +1100, sjmachin at lexicon.net wrote:
> > Pyrex appears not to support (yet?) a statement like: > > cdef int
> blah_table[5] = {0, 1, 2, 42, 255}
>
> > Any better suggestions?
>
> I would like to see this implemented.
+1
> I'd suggest the Python style
> syntax using parenthesis and not curly braces, so it won't look like
> you're building a broken dictionary.
-1
The "cdef" at the front tells the human reader and the Pyrex parser what to expect i.e.
C-style syntax. A Python-style dictionary, broken or not, is not expected in that context.
>
> cdef int blah_table[5] = (0, 1, 2, 42, 255)
>
> I'd also like to support unsized arrays:
>
> cdef int blah_table[] = (0, 1, 2, 42, 255)
>
> And this may make sense in structs and such too, where pyrex doesn't
> need the size at compile time. If need be, the C compiler can get you
> the size using an ugly application of sizeof.
>
More information about the Pyrex
mailing list