Oh Dear

Rainer Deyke rainerd at eldwood.com
Sun Jul 12 18:44:13 PDT 2009


Walter Bright wrote:
> If Python always used floor division, why did it add a // operator that
> does exactly the same thing as / ?

Starting with Python 3.0, 'a / b' returns a float even when both
operands are integers.  'a // b' performs floor division, even if both
operands are floats.  Python now has two division operators, neither of
which has C-style truncation (i.e. round toward zero).

This is explained further in the actual PEP 238 text:
http://www.python.org/dev/peps/pep-0238/


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list