Python 3000 deat !? Is true division ever coming ?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Fri Feb 17 04:54:23 EST 2006


On Thu, 16 Feb 2006 20:55:42 -0800, seb.haase wrote:

> I don't think "Because this change might break code, it's being
> introduced very gradually. Python 2.2 begins the transition, but the
> switch won't be complete until Python 3.0."   says enough.

I'm not sure what else should be said.

> Should I start using
> "from __future__ import division" in my modules ?

I don't know. Do you use integer or floating point division? Do you like
writing float(x)/y instead of just x/y?

> I fear that it might make my code "unreadable" (people would not expect
> this when reading somewhere in the middle of the module !!!)

Anybody using Python *should* be aware of the division issue. As soon as
they see a division, it is their responsibility to *find out what it
means*. That doesn't require much work: they can scroll up to the
beginning of the module and look at the first few lines. That's not hard.

Anybody person who is unwilling to scroll to the start of the module or
use their text editor to search for "from __future__ import division"
shouldn't be programming.

I'll allow for the occasional newbie who somehow has missed out on
learning about true division, but that's no reason to not implement
features in the language. The cost of confusing a newbie once in a month
of Sundays is far less than the benefit of introducing true division.


-- 
Steven.




More information about the Python-list mailing list