[Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

Kent Johnson kent37 at tds.net
Fri Dec 29 20:24:39 CET 2006


Chris Calloway wrote:
> Generators now have a different syntax, so some applications would need 
> some updating in order to take advantage of 2.5.

The old syntax still works. "yield x" is now an expression returning a 
value, rather than a statement, so it can be used in new ways, but a 
plain "yield x" is fine.

> The new "with" statement is very cool, though.
> 
>> I've personally held back just because most of the 
>> documentation I've come across is for 2.4,
> 
> 100% of this is Python 2.5 documentation:
> 
> http://docs.python.org/
> 
> Very little of it had to change from the last version.

To amplify this a bit - backward compatibility between Python releases 
is generally excellent. It is rare for something that works in 2.x to 
fail in 2.x+1. There may be a better way to do something using a new 
feature but the old ways will usually work.

So if you are learning Python from a book that covers 2.3 or 2.4, you 
should do fine with 2.5. When you want to know what has been added that 
is not in your book, check the excellent "What's New in Python 2.x" 
guides that are included with the docs for each version. These guides 
also include a "Porting to Python 2.x" section that lists the 
incompatible changes in the new version. For example, see
http://docs.python.org/whatsnew/porting.html

Kent



More information about the Tutor mailing list