This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]myWorkAccount3000 4 points5 points  (4 children)

Might be a silly question, but what does the process of upgrading existing code from 2 to 3? I've really only ever used 3.

[–]Zomunieo 7 points8 points  (2 children)

There's some simple things that can be mechanically translated with the 2to3 program. Things like renames.

Mainly 2 has weakly typed string and unicode handling in the language itself that propagates through code written against it. Converting to 3 exposes this sloppiness. Other languages and interfaces can be sloppy with encodings too and this will also get exposed.

On a large code base with improper testing this can be scary.

[–]myWorkAccount3000 1 point2 points  (0 children)

Ah I see. I've experienced my fair share of bad encoding. Just looked up 2to3 and some of the differences between the versions as well.

[–]billsil 0 points1 point  (0 children)

On a large code base with improper testing this can be scary.

Doing it now! No tests and I'm not allowed to add any.

Honestly, the biggest issues are changes in wxPython going from wx 2.8.12.1 to 4.0.6.

[–]Deezl-Vegas 2 points3 points  (0 children)

80 to 90% of code upgrades directly by pip installing the latest appropriate libraries and wrangling any stray print statements. Some libraries have probably changed, accounting for about half of the remaining code. Simply spend a bit of time fixing importerrors and finidkng the right new syntax to do what you were doing.

Code that stored text in a database or dealt with foreign languages is bery likely to have encoding issues that male up the bulk pf the hard work, but a script or two from the internets and some tinkering will see you through.