On Sun, May 22, 2016 at 11:55 AM, Jon Ribbens <jon+use...@unequivocal.co.uk> wrote: > On 2016-05-22, Random832 <random...@fastmail.com> wrote: >> On Sun, May 22, 2016, at 12:46, Jon Ribbens wrote: >>> Sorry, I have to stop you there as the entire premise of your post is >>> clearly wrong. "int" is not "an approximation of real numbers", it's >>> a model of the mathematical concept "integers", >> >> It is a representation of Z, a subset of R > > Yes, that's what I just said. "Z" is just (an approximation of!) > a symbol that means "the set of integers". > >> (as is float, technically, though that particular subset has no nice >> name like Z and Q) The operators that apply to it are the operations >> on R, even operations under which Z (or even R) is not closed. > > No, in Python integers are closed under the standard arithmetic > operators (+ - * / % **) - except, since Python 3, for "/", which > is now a special case.
If you want Python integers to be closed under division *and* be mathematically correct then the result of 1 / 2 should be the multiplicative inverse of 2, which is *undefined* in Z. While that might be an argument for raising an exception, it's not in any way a justification of returning 0. -- https://mail.python.org/mailman/listinfo/python-list