Hacker News new | ask | show | jobs
by fullwedgewhale 4074 days ago
It raises some good points. It makes me think of other projects I've been a part of where the working, existing system was starved for resources in favor a new system which didn't exactly dominate in performance or capability.

I've been programming for almost 20 years but am new to Python. I'm currently working on an API for a product and testing it against 2.7 and 3.4. It's not the end of the world, and if it works for 3.4 it pretty much works in 2.7. Granted, it's not the world's most complex or deep piece of python, but is there a real problem in making 2.X code run on 3.X? Is it really that big of a change?

1 comments

It's easy to get your own code to run on 3.x. The challenge is making sure all your C library dependencies run on it. And Python is nothing without its vast library ecosystem.
I ported APSW to Python 3 during the Python 3 beta (2008 IIRC) and thought I was being late! Porting the C code was easy - just a few #if sections selecting between Python 2 and 3. What took considerably more effort was porting my test suite. In addition to normal functionality, it does far more testing of boundary conditions and errors. I finally ended up with a codebase that compiles unaltered on Python 2.3 all the way through 3.5 (except 3.0), and the same Python source file that does testing against all those version and popular platforms with issues (ie Windows). To date I have never had a bug report where sample code was for Python 3 - it is always Python 2.

I also provide binaries for all the Python versions in both 32 bit and 64 bit (where relevant) for Windows. When hosted on Google Code, their download stats showed the vast majority on Python 2.7 32 bit with a slow increase in 2.7 64 bit. Python 3.x downloads were roughly similar to Python 2.4 downloads! Sadly since moving to Github I have no idea what the download rates are.

BTW the only reason for not supporting Python 3.0 was that the test suite needed a module that wasn't provided (base64 or something similar), which I could have worked around, but the 3.0 release was end of lifed so I didn't bother.

Got it, thanks!