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]
http://python.sourceforge.net/peps/pep-0238.html
[some of the threads on the topic]
http://groups.google.com/groups?hl=en&safe=off&th=cf5af74a6441c030,186
http://groups.google.com/groups?hl=en&safe=off&th=22f8a9bfd33f1099,252
|