running python 2 vs 3

Rustom Mody rustompmody at gmail.com
Thu Mar 20 22:20:21 EDT 2014


On Friday, March 21, 2014 2:23:25 AM UTC+5:30, Ned Batchelder wrote:
> On 3/20/14 4:42 PM, Marko Rauhamaa wrote:
> > Ned Batchelder :
> >> Plenty of people have adopted a dual-support strategy, with one code
> >> base that supports both Python 2 and Python 3. The six module can help
> >> a great deal with this.
> > I wonder how easy the resulting code is to the eyes and how easy it is
> > for the casual maintainer to accidentally break the delicate balance. In
> > a word, I wouldn't go there. Stay with Python2 as long as you must and
> > then, migrate and leave it behind.

> This is fine advice for applications, but tools, libraries, and 
> frameworks may want to support more than one version at the same time.

> It's an extreme case, but the latest released version of coverage.py 
> supports Python 2.3 through 3.3 with one code base.  To do it, there's a 
> compatibility layer (akin to six).  Then you stay away from features 
> that aren't available on all versions.  In a few places, you might need 
> to have version checks, and the code can get a little idiomatic to 
> continue to work.

> It's a tradeoff: you have to decide for yourself whether the effort is 
> worth the benefit.  I was glad to be able to drop support for 2.3, 2.4, 
> and 2.5, and now only support 2.6-3.4 in coverage.py.

Ned is talking to (and from) a lib-writer perspective
Marko is talking from noob perspective (which is what the OP looks like)

Good to choose our hats appropriately



More information about the Python-list mailing list