Rainer Deyke wrote:
Walter Bright wrote:
According to the python pep, the integer / divide semantics changed from
"C" style to match what the floating point / does. While this makes
sense for a language that is typeless, it doesn't work for D because:
The PEP is wrong (which underlines the need for accurate documentation,
I guess). Integer division in Python uses floor division instead of
truncated division, and to the best of my knowledge has always used
floor division. This is the result of a deliberate choice. Floor
division is usually technically superior to truncated division
The operator for integer division in Python has recently changed from
'/' to '//', but Python still has an integer division operator and this
operator still uses floor division.
If Python always used floor division, why did it add a // operator that
does exactly the same thing as / ?
http://www.python.org/doc/2.2.3/whatsnew/node7.html