Hi all,

is there already an operator named %% (double-percent)?
Somewhere in Python or its relatives?

If not, we could have the best of both worlds. Just let act in Cython
% as the corresponding C operator, i.e. -1 % 5 == -1 (to have maximal
speed), and let in Cython %% act as the Python % operator, i.e. -1 %%
5 == 4 (to have maximal convenience).

In Python, we also have the // (double-slash) operator, which does not
exist in C, so an uninitiated programmer coming across %% for the
first time has a good chance of guessing what that means. And as Craig
pointed out above, "descending from Python to Cython" we already have
to make certain (but very few and easily remembered) changes.

I then would allow %% to be used in Sage, too, just to have this
unambiguous notion available.

Thoughts?

Cheers,
gsw


P.S.:
As William pointed out somewhere, the meaning of 1/2 differs between
different Python versions (right now I don't remember the exact
details).

P.P.S.:
I'd vote against making this dependent on compile-time options. This
leads to non-portable code (think of having to merge two code
fragments relying on different choices of these options --- what a
nightmare).
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to