for / while else doesn't make sense

Ian Kelly ian.g.kelly at gmail.com
Sun May 22 19:04:11 EDT 2016


On Sun, May 22, 2016 at 11:55 AM, Jon Ribbens
<jon+usenet at unequivocal.co.uk> wrote:
> On 2016-05-22, Random832 <random832 at 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.



More information about the Python-list mailing list