osdir.com


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

What is your experience porting Python 2.7.x scripts to Python 3.x?


On 2019-01-22, Cameron Simpson <cs at cskk.id.au> wrote:
> On 22Jan2019 19:20, Grant Edwards <grant.b.edwards at gmail.com> wrote:
>>On 2019-01-22, Schachner, Joseph <Joseph.Schachner at Teledyne.com> wrote:
>>> For anyone who has moved a substantial bunch of Python 2 to Python
>>> 3, can you please reply with your experience?
>>
>>If you used bytes (or raw binary strings) at all (e.g. for doing
>>things like network or serial protocols) you're in for a lot of pain.
>
> Yes, but you will be the better for it afterwards.

It's a lot better if you're leaving Python2 behind.  If you're
maintaing 2/3 compatible code that uses bytes, the pain is chronic
rather than acute.

> I've had a few programs which worked with binary data, and often
> also "text". In Python 2 there was _constant_ uncertanty when these
> were mixed (writing text into binary fields and related). In Python
> 3 I am never confused. It is a huge win.

For whatever reason, I guess I never ran into that very much.

-- 
Grant Edwards               grant.b.edwards        Yow! Here I am in the
                                  at               POSTERIOR OLFACTORY LOBULE
                              gmail.com            but I don't see CARL SAGAN
                                                   anywhere!!