[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Saying bye bye to Python 2

On Sun, Jan 12, 2020 at 4:50 AM Gunnar ??r Magn?sson
<gunnar at> wrote:
> > I thought that upgrading is not that simple.
> It depends.
> If you have Python 2 code that deals with a lot of text in byte form, and it's kind of vague where you convert from bytes to strings, you may have a bad time.

It's always hard to port buggy code or underspecified code. If you
have code written in some hypothetical language that doesn't
distinguish properly between 16-bit ints and 64-bit floats, and has
sloppy conversions between them and different semantics, then it would
be a pain to port that to any other language. Ultimately, the cure is
to figure out the programmer's original intention and implement that.

> Otherwise, it may not be that bad. I ported around 500k lines of Python 2 to 3 this year, and it went smoothly. The most valuable resource I found was eevee's post on the subject:
Python <python-list at>
Indeed. Especially if you're porting to a fairly recent Py3, chances
are that most of the code will work just fine. There'll be just a few
places where you have to manually figure things out, and for the rest,
automated conversions like 2to3 will cover it. (And a lot of it
doesn't even need automated conversion. There aren't actually THAT
many things to change.)