Python changes
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Fri Oct 29 05:01:59 EDT 2010
On Thu, 28 Oct 2010 14:14:43 -0400, Craig McRoberts wrote:
> First off, greetings from a newbie!
>
> Here's the deal. I gained a passable knowledge of Python nearly ten
> years ago. Then I decided a career in the computer sciences wasn't for
> me, and I let it go. Now I find myself back in the development arena,
> and I'd like to pick up Python again. How much has it changed in my ten
> years' absence? I've already resigned myself to starting over from the
> beginning, but are my books from that time period even worth using now?
The one sentence summary: if you're on a tight budget, and want to re-
learn Python on the cheap, you can reuse your old books, plus free
resources on the web, but if you're in a hurry it will be easier to buy
some new books.
Longer version:
Ten years ago would have been around version 1.5 or 2.0, give or take. As
a language, Python has been very conservative. The basic syntax of Python
1.5 still works. If you stick to Python 2.6 or 2.7, there have been
virtually no backwards incompatible changes since version 1.5. The only
exceptions I can think of:
* some libraries have been dropped;
* a change in the way hex() and oct() of negative numbers is displayed;
* nested functions behave differently;
* the occasional new keyword has been added (e.g. yield).
Other than that, you can take virtually any example from Python 1.5 and
run it in Python 2.7 and it should still work. It might not be the best
way to solve the problem, but it should do it.
Most of the changes from 1.5 to 2.7 have involved *adding* features,
rather than taking them away. To learn the new features, read the Fine
Manual, especially the What's New that comes out with every new version,
or go out and buy a book covering the latest version.
If you advance to Python 3.1, you can add to the list of backward
incompatibilities:
* minor differences in the way classes work;
* print is now a function, not a statement;
* strings are now Unicode, rather than bytes;
* various functions and methods which used to return lists now return
iterators;
plus others I've forgotten. That makes a jump from 1.5 to 3.1 rather more
problematic, but it can still be done -- the basic language is still
almost identical, the syntax hasn't changed much, but there's a whole lot
of new functionality that will make your life easier.
--
Steven
More information about the Python-list
mailing list