Python 2 to 3 conversion - embrace the pain

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Mar 19 18:48:14 EDT 2015


On Thu, 19 Mar 2015 03:35 am, Paul Rubin wrote:

> Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:
>> The two weeks we lost upgrading from Python 2.6 to 2.7 is just the
>> normal upgrade pains you always have to expect from any major project,
> 
> Wait, what happened between 2.6 and 2.7 that took you two weeks of
> upgrading?

Read my comment in context. I'm talking about the perception (shared by
various people) that it is not uncommon to hit a two week delay when
upgrading a major project between *any* two Python versions, not just
between 2.7 and 3.4. I'm not relating a specific anecdote.

Unless a project is specifically written to be flexible about the versions
it works with[1], chances are good that any .x version change will break
something. If you're lucky, it will just break things in your own code,
which you can easily fix. If you're unlucky, it will break things in your
dependencies, which you can't. It's not hard to lose a few weeks in working
around bugs in third-party libraries.

People freak out about the syntax changes going from 2.x to 3.x, or the
changes to standard library module names. But let's look at the actual
issues John ran into:

- BeautifulSoup 4 has a known bug and crashes on some websites;

- PyMySQL gave an obscure error with one specific command unless 
  your MySQL database was configured with 16MB buffers;

- TLS/SSL support ran into a complex interaction between Python,
  Firefox's SSL certificates, OpenSSL and Verisign.

- A memory corruption bug in the C implementation of the Python
  3.4 pickle module.


You'll note that *none of these* issues are specific to the backwards
incompatibility between 2.x and 3.x. They all could have occurred between
any two versions of Python.




[1] And I'll admit that it's somewhat easier to cover (say) 2.6 + 2.7 rather
than 2.7 + 3.3. But it is doable: apart from trivial single use scripts,
all my code targets 2.4 through 3.3+ and beyond, and with a few exceptions,
it's not that painful. (I did try supporting 2.3 as well for a little
while, but that wasn't merely painful, it was agonising. 2.3 is seriously
lacking built-in functionality compared to what follows.) I'm looking
forward to retiring my Centos 5 machine, because then I can drop support
for 2.4 and 2.5. That will make me sooooo happppy!!!


-- 
Steven




More information about the Python-list mailing list