[MATRIX-SIG] integer division -- what a concept!

Paul F. Dubois Paul F. Dubois" <dubois1@llnl.gov
Fri, 16 Jan 1998 12:48:13 -0800


There is a long-established history of this behavior in both Fortran and C.
People use it on purpose for lots of different applications. It would be a
surprise to most scientific programmers if it behaved otherwise.

Another way to look at it is, suppose you saw:

x = i / j

Wouldn't you be surprised that the type of x depended on the data?

The i vs. j for complex constants issue was well discussed in the SIG, and
it was simply necessary to choose one and annoy half the people, or choose
both and annoy Guido. There simply are two different cultures out there on
this issue.

-----Original Message-----
From: Charles G Waldman <cgw@pgt.com>
To: Rupert Mazzucco <maz@pap.univie.ac.at>
Cc: matrix-sig@python.org <matrix-sig@python.org>
Date: Friday, January 16, 1998 12:12 PM
Subject: [MATRIX-SIG] integer division -- what a concept!


>
>Rupert Mazzucco writes:
> > Q: What is n/(n+1)?
> > A: 0
> >
> > This is of course wrong for most practical purposes,
> > but it is the result Python will give.
>
> > So, is there any way to change this behaviour?
> >
>
>This was brought up as an issue at the October conference.  The
>authors of "Alice", a Python-based interactive 3D graphics
>environment intended for students, thought this behaviour unintiuitive
>enough that they ship out Alice with a modified version of Python.
>(Their modified version changes Python so that 1/2 == 0.5, which I
>like, but they also made all symbols case-insensitive, which I think
>is a terrible idea....).   One of the guys from the Alice team got up
>and asked what it would take to bring these changes into Python.  But
>as I remember it, the ensuing conversation centered around why it's a
>bad idea to have X==x,  and not on integer division.  For what it's
>worth,  I agree with you that the default behavior is too influenced
>by the corresponding behavior in C.
>
>My own personal wishlist is that 1/2==0.5, and I'd also like to see
>the silly "j" changed to an "i"  ;-)
>
>But I don't think either of these things is going to happen, unless
>there is a groundswell of support.
>
>
>
>_______________
>MATRIX-SIG  - SIG on Matrix Math for Python
>
>send messages to: matrix-sig@python.org
>administrivia to: matrix-sig-request@python.org
>_______________
>


_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________