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

Sturla Molden sturla@molden...
Thu Mar 12 17:45:02 CDT 2009





> 2009/3/13 Charles R Harris <charlesr.harris@gmail.com>:
>> That said, I think it best to leave '%' with its C default and add a
>> special
>> modulus function for the python version. Changing its meaning in C-like
>> code
>> is going to confuse things.
>
> This is Cython code, so I think there is an argument to be made that
> it is Python-like!


I'll just repeat what I've already said on the Cython mailing list:

I think C types should behave like C types and Python objects like Python
objects. If a C long suddenly starts to return double when divided by
another C long, then that will be a major source of confusion on my part.
If I want the behaviour of Python integers, Cython lets me use Python
objects. I don't declare a variable cdef long if I want it to behave like
a Python int.

Sturla Molden


















More information about the Numpy-discussion mailing list