[Tutor] Bad time to get into Python?
Kent Johnson
kent37 at tds.net
Sun Feb 3 20:01:41 CET 2008
Dotan Cohen wrote:
> The little programming that I need I have been able to get away with
> silly php and bash scripts. However, my needs are getting bigger and I
> see Python as an ideal language for my console apps, and the
> occasional GUI that I might write for the wife. However, with the
> coming of Python3 and the new syntax, is this a bad time to start
> learning Python? I don't want to learn 2.x if 3.x will replace it, and
> not be compatible, in one year. I know that I can continue using 2.x,
> but maybe I should wait until 3.x is released to start learning? What
> does the community think?
Don't wait. Python 2.5 is very useful today. Python 2.x will be viable
for years. Python 2.6 is not even scheduled for release until this
summer and it will be maintained long after that. PEP 3000 says,
"I expect that there will be parallel Python 2.x and 3.x releases for
some time; the Python 2.x releases will continue for a longer time than
the traditional 2.x.y bugfix releases. Typically, we stop releasing
bugfix versions for 2.x once version 2.(x+1) has been released. But I
expect there to be at least one or two new 2.x releases even after 3.0
(final) has been released, probably well into 3.1 or 3.2. This will to
some extent depend on community demand for continued 2.x support,
acceptance and stability of 3.0, and volunteer stamina."
http://www.python.org/dev/peps/pep-3000/
> That asked, I've heard that 2.6 can be configured to warn when using
> code that will not run in 3.x. Is this correct? How is this done? I'd
> like to do it on a per-file basis, so that I will only need to run one
> version of python on this machine. I want my own apps to throw errors,
> but not other python apps on this system. Is there some error-level
> code that I can run?
There is a command-line switch in 2.6, -3, which will enables warnings
about features that will be removed in Python 3.0, and some features of
Python 3.0 are being back-ported to Python 2.6:
http://docs.python.org/dev/whatsnew/2.6.html#python-3-0
There is also a tool being developed (2to3) to convert Python 2.x code
to 3.0 semi-automatically:
http://svn.python.org/view/sandbox/trunk/2to3/README?rev=57919&view=markup
However, the goal of these efforts, IIUC, is *not* to allow a single
script to run in both 2.6 and 3.0, it is to enable easy porting from 2.6
to 3.0. In particular, my understanding is that the -3 warnings will
warn of constructs that cannot be correctly converted by 2to3. More
details here:
http://www.python.org/dev/peps/pep-3000/#compatibility-and-transition
So I would say the outlook for 2.6 is better than you think but the
outlook for compatibility is worse.
Kent
More information about the Tutor
mailing list