[Tutor] "from future import division"?
Terry Carroll
carroll@tjc.com
Tue Jul 15 01:58:01 2003
I'm running Python 2.2.2 (under Windows). I want / to perform true
division, not integer division. That is, I want 1/2 to return 0.5, not
0.0.
"Python in a Nutshell" says this will be the default in 2.3, and until
then, I can either include the line:
from future import division
or invoke python as
python -Qnew foo.py
the -Qnew option works, but the import does not:
ImportError: No module named future
Any ideas? Is my syntax wrong, or is there a "future" module that's
supposed to come with Python that's missing for me, but that I can
install? Or is there some other change to the source code I can make to
cause Python to do true division?
I'd like to just use true division, rather than adding decimal points in
every operation to force true division, which looks messy (I'm doing a lot
of reciprocals), and without overriding the command line.
--
Terry Carroll | "I say to you that the VCR is to the American
Santa Clara, CA | film producer and the American public as the
carroll@tjc.com | Boston strangler is to the woman home alone."
| Jack Valenti, MPAA President
Modell delendus est | Testimony before Congress, 1982