Q: Feature Wish: "%" Extension

Tim Peters tim.one at home.com
Sun Nov 4 22:09:21 CET 2001


[Tim]
> An odd thing is that, when this comes up, people complain that under
> Python's current rules it's not necessarily the case that
>
>     (-i)/j == -(i/j)
>
> Across decades of integer numeric programming, I can't recall any
> *use* for that identity; but that i%j >= 0 whenever j>0 is endlessly
> useful, as is your identity relating int-div and int-mod.

[John Roth]
> Useful as it is, it makes division not be the
> inverse of multiplication, so it's mathematically incorrect,
> and hence astonishing to people who don't know the score.

What does "it" mean?  Sorry, but I can't make sense out of your comment.  I
was talking about truncating integer divsion versus flooring integer
division; i/j == k does not imply i == j*k under either of those.





More information about the Python-list mailing list