Python 3000 deat !? Is true division ever coming ?

Magnus Lycka lycka at carmen.se
Mon Feb 20 14:36:01 EST 2006


Steve Holden wrote:
> seb.haase at gmail.com wrote:
>> My main point was/is:  why is there not more discussion about "true
>> division" !!?
> 
> You are about three years too late for the discussion. It was debated to 
> death when Guido proposed that Python should behave more like 
> non-programmers expected it to. Despite some fierce opposition this view 
> eventually held sway, and now long-time Pythonistas accept it as the way 
> forward.

I think you should understand "discussion" as "mentioning" or
"documentation" here.

However much it was discussed three years ago, enabling it as
default in 3.0 will be a bit like the Vogons suddenly appearing
to demolish Earth, if it hasn't been documented clearly.

The tutorial shouldn't teach a coding style that will cause
problems when we reach the next major version of Python. At
least not if it's easily avoided.

Python has supported true division for more than four years, and
it's been decided from the onset that this will be default behaviour
in 3.0. The Tutorial basically ignores it. Ok, it's mentioned in
passing in the glossary, but not where it explains how division works!

> So basically most people saw your question and probably thought "enough, 
> already!".

Having followed comp.lang.python for several years should not be a
requirement for programming Python properly. Neither should it be a
requirement to read all the PEPs or "what's new in Python version
2.2" when someone starts learning Python with 2.4! I had more or less
forgotten about this (do you use "from __future__ import division"
in all your scipts Steve?) so I think it's a good thing that this
was brought up. Particularly if Guido's Google jobs brings 3.0
closer to its release...

I started http://wiki.python.org/moin/FutureProofPython as a place
to document this, but I doubt that yet-another-wiki-page is the
perfect solution for this. It might be useful as a placeholder for
the time being though, and I hope that some of you who are better
at this than I am improves that page a bit, and more importantly,
that it gets into the Tutorial.

I've now inspected more than 1700 python files from a number of
sources, Twisted being one of them, with 235kLoC, written by scores
of different developers. I found no "from __future__ import division"
statement, but almost 7000 lines with '/' that needs to be inspected
one way or another. (Not all divisions, I'm sure, but still a
substancial amount of work to check, and plenty of new test cases.)



More information about the Python-list mailing list