[Numpy-discussion] Poll: Semantics for % in Cython

Gael Varoquaux gael.varoquaux@normalesup....
Thu Mar 12 13:50:30 CDT 2009

On Thu, Mar 12, 2009 at 07:59:48PM +0100, Dag Sverre Seljebotn wrote:
> (First off, is it OK to continue polling the NumPy list now and then on 
> Cython language decisions? Or should I expect that any interested Cython 
> users follow the Cython list?)

Yes, IMHO.

> In Python, if I write "-1 % 5", I get 4. However, in C if I write "-1 % 
> 5" I get -1. The question is, what should I get in Cython if I write (a 
> % b) where a and b are cdef ints? Should I

> [ ] Get 4, because it should behave just like in Python, avoiding 
> surprises when adding types to existing algorithms (this will require 
> extra logic and be a bit slower)

> [ ] Get -1, because they're C ints, and besides one isn't using
> Cython if one doesn't care about performance

Behave like in Python. Cython should try to be as Python-like as
possible, IMHO. I would like to think of it as an (optionally)
static-typed Python.

My 2 cents,


More information about the Numpy-discussion mailing list