[Numpy-discussion] Cython/NumPy syntax

Gael Varoquaux gael.varoquaux@normalesup....
Wed Aug 6 08:33:07 CDT 2008


On Wed, Aug 06, 2008 at 10:35:06AM +0200, Dag Sverre Seljebotn wrote:
> Stéfan van der Walt wrote:
> > 2008/8/6 Dag Sverre Seljebotn <dagss@student.matnat.uio.no>:
> >> - Require an ndim keyword:

> >> cdef numpy.ndarray[numpy.int64, ndim=2]

> > I'd definitely prefer a comma between the two, and an (optional) ndim
> > keyword argument if possible.

> I'm taking this as a vote in favor of this and against "2D" and <>?

> The keyword is already present in optional form (you can do already do 
> "ndarray[ndim=3, dtype=numpy.int64]" if you want to). So I meant to ask 
> whether making it mandatory is a good solution so that the 2 doesn't 
> look like a length specifier.

> (ndim=2 seems too long for me though, which is why I am pondering "2D".)

I am definitely +1 on ndim keyword argument. Make it compulsory if you
have to. I don't really like 2D. The nice thing about the ndim keyword
argument is that is mean we still are using valid Python syntax which
means that iit is easier to grok for the user, and which may come in
handy one day, as we can use standard Python tools on the expression. And
I don't thing that "ndim=2" is too long.

Gaël


More information about the Numpy-discussion mailing list