Why Python 3?

Terry Reedy tjreedy at udel.edu
Sun Apr 20 00:17:17 EDT 2014


On 4/19/2014 9:06 PM, Gregory Ewing wrote:
> Chris Angelico wrote:
>> I'd rather have to explicitly request floating-point division;
>
> When you write / in Python 3, you *are* explicitly requesting
> floating-point division.
>
> Similarly, when you write // you're explicitly requesting
> integer division.

One is requesting 'floor division'

 >>> 3.0//2.0
1.0

To me, calling that integer division is a bit misleading in that one 
might expect the result, at least, to be an int rather than a float. 
(Yes, it is an integer-valued float.)

-- 
Terry Jan Reedy




More information about the Python-list mailing list