[Cython] #define, or equivalent?

Stefan Behnel stefan_ml at behnel.de
Tue May 12 18:36:06 CEST 2009


Brian Blais wrote:
> I have a number of arrays that need to be some maximum size, and I was
> wondering if there is some way to define that size at the top of the
> code, the equivalent of:
> 
> #define MAXSIZE 10
> 
> I haven't seen any examples of this.  So far I have just put the number
> in manually, like:
> 
> cdef a[10],b[10],c[10]
> 
> but I'd rather have:
> 
> cdef a[MAXSIZE],b[MAXSIZE],c[MAXSIZE]
> 
> is there a way of doing that?

You might be happy with the "DEF" statement (capital letters).

Stefan



More information about the Cython-dev mailing list