Lambda the Ultimate

inactiveTopic Python's proposed change to integer division
started 7/26/2001; 4:25:31 AM - last post 7/29/2001; 10:32:13 AM
Adewale Oshineye - Python's proposed change to integer division  blueArrow
7/26/2001; 4:25:31 AM (reads: 785, responses: 2)
The main python newsgroup (comp.lang.python) is intensely discussing a proposal to change the way the language handles integer division. Currently in Python int/int evaluates to an int. So 5/2=2. This is apparently confusing to newbies and is scheduled to be changed.

Proposed changes include: Changing int/int to evaluate to a float. So 5/2=2.5 And most controversially of all: Having 2 division operators.

// which would behave the old way "int//int==int". And changing the meaning of the old division operator so that (int/int==float). This of course would break any code using divide and conquer algorithms that are dependent on integer division.

One of the interesting facts that came out of this debate is that in languages like Java, C and C++ int/int==int whilst in Perl and Scheme int/int==float.

Useful places for an understanding of the issues: [the original proposal]

[some of the threads on the topic],186,252

Chris Rathman - Re: Python's proposed change to integer division  blueArrow
7/28/2001; 9:19:26 AM (reads: 828, responses: 1)
I started from a Pascal background, so the C convention of overloading the divide operator based on the arguments is not necessarily "natural" from my perspective. So, other than possibly breaking some code, or causing confusion among current Python experts, I think the change would be for the better - though many other languages use the backslash (intint == int) for the integer divide.

Ehud Lamm - Re: Python's proposed change to integer division  blueArrow
7/29/2001; 10:32:13 AM (reads: 884, responses: 0)
I for one, having used many languages, always check integer divides with hawk eyes. It is just one of those things that like to come and bite you in the...