I may have agreed with this a year or two ago. Not now though. The situation is way better than it used to be, and only improving.
Developing a new module to run on both Python 2 and Python 3 is also much less of a pain than it used to be. Particularly if you follow the advice on (http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/). It does make your code less beautiful than a pure Python 3 code base, but that is the price you pay for compatibility.
My biggest porting headache was adding Python 3 support to PyFilesystem. It was tricky because this library is an abstraction layer for files, which work quite differently in Python 3, and we didn't want to have to write everything from scratch. I have ported another, much larger project, in a day. It was tedious work, but no major issues.
But these problems only effect library developers. If you're building an application, just use Python 3. Most libraries have Python 3 support, and most of the ones that don't are probably not actively maintained any more.
I agree almost all libraries are developing support for python 3. It is true that you will have some problems with old scripts where there are xrange, parenthesis for exceptions and print, and urllib2 is all over the place.
If you start new I would do python 3. If you are converting it is kind of a hassle that might take about a day or more to fix all the differences.
69
u/willm May 26 '14
I may have agreed with this a year or two ago. Not now though. The situation is way better than it used to be, and only improving.
Developing a new module to run on both Python 2 and Python 3 is also much less of a pain than it used to be. Particularly if you follow the advice on (http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/). It does make your code less beautiful than a pure Python 3 code base, but that is the price you pay for compatibility.
My biggest porting headache was adding Python 3 support to PyFilesystem. It was tricky because this library is an abstraction layer for files, which work quite differently in Python 3, and we didn't want to have to write everything from scratch. I have ported another, much larger project, in a day. It was tedious work, but no major issues.
But these problems only effect library developers. If you're building an application, just use Python 3. Most libraries have Python 3 support, and most of the ones that don't are probably not actively maintained any more.