Oh Dear

Rainer Deyke rainerd at eldwood.com
Sun Jul 12 17:02:59 PDT 2009


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.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list