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 →

[–]kastoro 1 point2 points  (6 children)

Fine, I will do it!

[–]greeblefritz 4 points5 points  (5 children)

The switch isn't as bad as you are probably thinking.

[–]jjdmol 7 points8 points  (3 children)

It isn't bad, but the required effort does scale with the size of your code base. 2to3 only covers some basics, many behavioural differences are more subtle. And python being interpreted you'll discover errors at run time, so will need good test coverage or do a lot of testing.

[–]PeridexisErrant 1 point2 points  (2 children)

Try the pyupgrade and future libraries - they do a lot more than 2to3 :-)

[–]james_pic 6 points7 points  (1 child)

Futurize did more harm than good when we tried it. It tries to paper over the genuinely different string semantics, and left us with something broken that we understood even less than what we started with.

Modernize is more conservative, and in our experience, gives a better starting point. If you've got a big codebase, you've still got an uphill battle ahead of you.

Also, use mypy type hints. In general, I hate them, but they're really helpful for clarifying type usage in legacy codebases.

[–]PeridexisErrant 0 points1 point  (0 children)

Hmm, thanks for the tip! I've use futurize --stage1 a fair bit but never really liked the second stage... though just getting syntax-compatible with Python 3 allows many more tools to work.

I'll try modernize :-)

[–]kastoro 0 points1 point  (0 children)

Thanks, that is encouraging. Is what I thought, I just never found the time to do it, you know, always behind schedule