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

Dag Sverre Seljebotn dagss at student.matnat.uio.no
Fri Mar 13 07:47:22 EDT 2009


Sturla Molden wrote:
>> On Fri, Mar 13, 2009 at 01:41, Dag Sverre Seljebotn
>>     
>
>   
>>>>   # Explicitly declared C types?
>>>>   cdef long i, j, k
>>>>   i = -1
>>>>   j = 5
>>>>   k = i % j
>>>>         
>>> This one is what I'm really asking about.
>>>       
>> My opinion on this is that C semantics have been explicitly requested,
>> so they should be used.
>>     
>
> I agree with this. I feel that "cdef long i, j, k" is a request to "step
> into C". But here I feel the Cython team is trying to make me step into a
> broken C.
>   
Well, first of all the Cython team as a whole is still undecided on the 
issue, notably project lead Robert Bradshaw is either undecided or 
leaning towards your view.

There's been lot of feedback, and they tend to fall into two groups:
- Declaring types means requesting C semantics
- Declaring types means typing the Python language to make it faster

So it's more about making it "typed Python" than "broken C" IMO. 
(Introducing a new set of types for "typed Python" is an idea that could 
please everybody, but I fear the confusion it would bring myself...)

Interestingly the Sage list, Cython list and NumPy lists all seem about 
equally divided on the issue.

Dag Sverre



More information about the NumPy-Discussion mailing list