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

Charles G Waldman cgw@pgt.com
Fri, 16 Jan 98 16:40:23 EST


Paul F. Dubois writes:
 
 > 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?
 > 

I really don't understand this comment.  It seems to me that this is
the case currently;  if I do

i=1; j=2; x= i/j; print type(x)

I get a different result than if I did

i=1; j=2.0; x=i/j;  print type(x)

Isn't the type of x dependent on the data?  (I'm not trying to be a
wise guy, I think I must be missing your point).  Imagine that i and j
aren't defined in the code but are being read in from a file.  Then
seeing the line "x = i/j" out of context, it's anybody's guess what
the type of "x" will be.  I'd rather have division *always* return a
float, and maybe have another operator like "//" for explicit integer
division. 

> 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.

I understand that this is a cultural thing... I'm just expressing my
own biases, being more of a mathematician than an engineer.   Euler
wrote "e**2 pi i + 1 = 0",  not "e**2 pi j + 1 = 0".  And that's good
enough for me.  Besides, what if I decide to make quaternions a
built-in type in Python?  (Just kidding.)

I guess I wasn't a member of the SIG yet when this was being
discussed.  Too bad, I would have agitated for "i".  But I certainly
don't think it's an important issue; I was only bringing it up under
the rubric of "the only things about Python that I think are wrong",
becuase I believe that in most everything else Guido got it right.




_______________
MATRIX-SIG  - SIG on Matrix Math for Python

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