On Aug 7, 2008, at 8:49 AM, Lisandro Dalcin wrote:

> I'm still convinced that Fortran 90 array declarators could provide a
> more powerfull syntax for buffers, For this, the dimensions should be
> specified with a tuple, examples below:
>
> cdef ndarray[int, ()] a # a  scalar
>
> cdef ndarray[int, (3,)] # a1D array with 3 items
>
> cdef ndarray[int, (:,)] # a 1D array of any size
>
> cdef ndarray[int  (2,3)] # 2D array with 2 rows and 3 columns
>
> cdef ndarray[int  (:,3)] # 2D array with any number of rows and 3  
> columns
>
> cdef ndarray[int  (:,:)] # 2D array with any number of rows and  
> columns
>
> cdef ndarray[float,  (3,3,:)] # 3D array,  a 'sequence' of 3x3 array
>
>
> We could even use Ellipsis '...' in a similar sense numpy uses them
>
> cdef ndarray[int, (...)] # any number of dimension
>
> cdef ndarray[int, (:, ...)] # at least 1D
>
> cdef ndarray[int, (:, : ,...)] # at least 3D
>
> cdef ndarray[int, (3, 5, ...)] # at least 2D, but required shape in
> first two dims.
>
>
> What do you think?

Right now all we're specifying is the dimension and type (certainly  
the most important), for which this syntax seems overkill and  
obscure. Potentially, if we want to support more in the future, we  
could look at using this notation which would be backwards compatible.

- Robert


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

Reply via email to