[Python-ideas] [Wild Idea] Static Ducks

Steven D'Aprano steve at pearwood.info
Thu Sep 24 02:03:24 CEST 2009

On Thu, 24 Sep 2009 12:21:07 am Gerald Britton wrote:
> wrong!  I did use Python:
> $ python3
> Python 3.0.1+ (r301:69556, Apr 15 2009, 15:59:22)
> [GCC 4.3.3] on linux2
> Type "help", "copyright", "credits" or "license" for more
> information.
> >>> 3/2
> 1.5
> >>> 3//2
> 1
> Surely we're not discussing an idea just for Python 2.x, are we?

Furthermore, classic division in Python 1.x and 2.x is harmful. Guido 
has publicly stated that defaulting to integer division in Python 1.x 
and 2.x was a mistake. In PEP 238 he calls it "a design bug".


If anyone doubts that "ordinary people" treat 3 and 3.0 the same, or 
that 3/2 is 1.5 rather than 1 + 1 remainder, I recommend you do a 
mini-survey of your family, friends and workmates. Obviously if you ask 
small children before they have learned about fractions, or 
mathematicians who have immersed themselves entirely into some field of 
study using only integers, you may get different results, but 6000-odd 
years of common practice is to treat "whole numbers" as identical 
to "decimal numbers where the fraction part is zero"[1]. The *lack* of 
distinction is so strong that we don't have a simple term to 
distinguish 3 from 3.0 -- both are "whole numbers".

[1] I'm aware that decimal notation doesn't go back 6000 years. But the 
ancient Greeks and Egyptians were perfectly capable of dealing with 
fractions, and they too failed to distinguish between a whole number 
plus a fractional part of zero and a whole number on its own.

Steven D'Aprano

More information about the Python-ideas mailing list