On Thu, 2009-03-12 at 19:59 +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?) > > 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 > > Whatever we do, this also affects the division operator, so that one in > any case will have a==(a//b)*b+a%b. > > (Orthogonal to this, we can introduce compiler directives to change the > meaning of the operator from the default in a code blocks, and/or make > special functions for the semantics that are not chosen as default.) >
I definitely fall into the "I prefer C semantics" crowd. Because my brain is in "C" mode whenever I write Cython. However, I totally understand the arguments from the other side, and I would not be upset if Cython went in that direction. You could say that I have my preference, but I can't make a strong argument for it. Chris _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion