Dag Sverre Seljebotn wrote:
> Robert Bradshaw wrote:
>> I'm less sure about how to expose the C operations, but just
>> accepting a 20-30% slowdown is not acceptable. We should provide
>> cython.cmod/cdiv, but I feel strongly we should provide an infix
>> option as well. I'm wary of introducing new operators, but the
>> %-, /-, and //- seems like the best options proposed. It is a bit
>> deceptive though, as we would not force the truncating rounding mode
>> for negative numbers, just pass it on to the C compiler (are there
>> any that don't make this choice?). Another option is to do something
>> very like c(%) or c_op(%), which is currently unused invalid syntax.
>
> How about this:
>
> cdef int a = -5, b = 3
>
> print a.cmod(b), a.cdiv(b)

Ah, that was easy, now that there's a ticket for these things already... ;)

http://trac.cython.org/cython_trac/ticket/236

But, sure, why not. Looks like a simple enough syntax to me, and it's
pretty close to an infix operator.

Stefan

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to