Anelok: next round of case parts 1/2: fixing issues

Elena ``of Valhalla'' elena.valhalla at gmail.com
Sun Jan 25 09:07:34 UTC 2015


On 2015-01-25 at 02:56:43 -0300, Werner Almesberger wrote:
> Bas Wijnen wrote:
> > If you want to be future-proof, you probably want to use python3, in
> > which 3/2 == 1.5 (and 4/2 == 2.0, not 2); you have to specify integer
> > division explicitly as 3//2 there.
> Oooh, that explains everything. That's a pretty fundamental change to
> make in a widely deployed language.
> [...]
> Hmm, just saw that they removed (converted) the print statement in
> version 3. And I thought the gcc folks were reckless ;-)

Python 3.0 was designed explicitely to allow for fundamental changes
that broke compatibility: in a way it can be considered almost a 
(close) derivative of python 2.x rather than a version of the same language.

Some changes were however backported to python2 and it is possible to 
write at least some code that is able to run under both 2 and 3 
by importing the relevant changes from __future__; it is the first
approach listed on https://wiki.python.org/moin/PortingPythonToPy3k

You can use just the new division behaviour by importing ``division`` 
from __future__, or you can import all of the four modules and 
try to keep the code running under both versions.

-- 
Elena ``of Valhalla''



More information about the discussion mailing list


interactive