Moving from Python 2 to Python 3: A 4 page "cheat sheet"

Wolodja Wentland wentland at cl.uni-heidelberg.de
Thu Dec 3 05:40:44 EST 2009


On Wed, Dec 02, 2009 at 08:03 -0800, Mark Summerfield wrote:
> On Dec 2, 11:20 am, Wolodja Wentland <wentl... at cl.uni-heidelberg.de>

> > It would be quite nice if you could mark all the Python 3 idioms that
> > work in Python 2.X as well. This would allow readers that are still using
> > Python 2.X and are used to the 'old way' to adapt their coding style
> > accordingly. You could just add a little (2.X) after the idiom for
> > example.

> Yes it would be nice, but it isn't quite so simple. 

> To take sorted() as just one example, it was introduced in 2.4 so
> arguably using it isn't valid/idiomatic for Python 2.x programs where
> you care about backwards compatibility for the Python 2.x series... 

Yes, which is why you could include a 2.X and people who target, say
current +/- 0.1 can choose their poison.

> But my main reason for not wanting to do this is that the document is
> aimed at people who want to write Python 3, not to encourage people to
> stick with 2:-)

I actually think that it is the other way round. People should get
familiar with py3 features even if they are not yet ready to
"abandon" py2 (yet). I also think that using some of the backported/supported
features might spur interest in features that are 'py3 only' and therefore
encourage the adoption of py3.

It would also be nice to have a summary of things people can do *now* if
they want to keep the changes from 2to3 to a minimum, which will be with
us for some time. But that is not something *you* have to write .. :-)
-- 
  .''`.     Wolodja Wentland    <wentland at cl.uni-heidelberg.de> 
 : :'  :    
 `. `'`     4096R/CAF14EFC 
   `-       081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20091203/24536d1d/attachment-0001.sig>


More information about the Python-list mailing list