Wilfred van Rooijen
wvanrooijen at yahoo.com
Tue Feb 9 14:22:38 CET 2016
There are many "gotchas" going from Python 2 to Python 3 - with the change from "print" to "print()" being by far the most irritating (and the most stringently enforced by the Python interpreter). There are several IDEs which can highlight problems and give tips to migrate from Python 2 to Python 3, or to write code that is compatible for both (in many cases, you can use "try.... except..." - if the Python 2 code crashes, you simply try to execute the Python 3 statement thereafter).
It is one of the "features" of the Python language that it is not supposed to be necessarily backward compatible, but obsolescent features and new features are announced with very generous transition periods, so that programmers have sufficient time to update their code. Unfortunately, the long lead time causes programmers to become lazy, since in practice, obsolescent features are supported for a long time, thus it is not necessary to update the code immediately.
For those who are interested: Python is a forward compatible language, where the statement:
from __future__ import bla
can be used to import the "bla" name; in this way, you can use bla before it becomes part of the official Python language, which (potentially) saves work in future code revisions. Obviously it takes an expert to know what __future__ functions there are and whether or not it is worthwhile to use them.
On Tuesday, February 9, 2016 7:00 PM, Philip TAYLOR <P.Taylor at Rhul.Ac.Uk> wrote:
Hallo Khaled --
Khaled Hosny wrote:
> There are many other Python 3 incompatibilities in the code (this
> being Python, you will not encounter them until the code in question
> is actually being executed, which can be deceiving). Regards, Khaled
Yes, I fully appreciate that; all I was trying to do was suggest some
simple zero-effort code that could be added to indicate whether the
system version of Python was compatible with the code as written and
issue an appropriate diagnostic; it was in no way an attempt to re-write
the code such as to make it compatible with both Python 2 and Python 3
other than at the most superficial (lexical) level.
Subscriptions, Archive, and List information, etc.:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the XeTeX