On Saturday 13 April 2013 16:53:42 Richard Heck wrote:
> Isn't there some "import __future__" thing we can use to make this easy? 
> Or is that what is only in 2.7?
> 
> Richard

python 2.7 supports both "from future import xxxx" as well as new features that 
were backported from python 3 (specifically from 3.1) such as python 2.6 as 
incorporated features from python 3.0

That why I said that it possible to write code that is compatible between 
python 2.7 and python 3, if necessary using 2to3 as Günter referred before.

FWIW http://docs.python.org/dev/whatsnew/ (with a list of what has changed 
between each version) is a nice read.

One example that illustrates my point, in lib/scripts/lyxpak.py we use sets 
(data structures, basically dictionaries where we only care about keys).

In python 3 a set can be declared as

{1,2,3,4,5}

and so can you using python 2.7.


In a sense this is a bad example because the previous syntax would still work 
set([1,2,3,4,5]) but I hope you get the point. :-)

-- 
José Abílio

Reply via email to