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

Charles G Waldman cgw@pgt.com
Fri, 16 Jan 98 14:58:42 EST


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
_______________