Saying bye bye to Python 2

Grant Edwards grant.b.edwards at gmail.com
Mon Jan 13 10:46:00 EST 2020


On 2020-01-11, Gunnar Þór Magnússon <gunnar at magnusson.io> wrote:

>> I thought that upgrading is not that simple.

> 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.
>
> Otherwise, it may not be that bad. I ported around 500k lines of
> Python 2 to 3 this year, and it went smoothly.

That's been my experience: unless you use raw bytes a lot, I find that
porting apps from 2 to 3 isn't difficult at all.  You sometimes have
to tweak text I/O stuff a little to fix encoding issues.

Porting apps that use bytes is more work, but if you're abandoning 2.x
support, usually not too bad.

The real headache is trying to keep a "byte-centric" application
backwards compatible so that it will run under 2.x or 3.x.  I used to
try to keep things backwards compatible, but have recently started to
abandon 2.x support in my (mostly internal) apps.

-- 
Grant Edwards               grant.b.edwards        Yow! I represent a
                                  at               sardine!!
                              gmail.com            



More information about the Python-list mailing list