On Monday, 1 July 2019 18.59.42 WEST Björn Persson wrote:
Porting a Python 2 program to Python 3 is not like switching to
another
version of GCC. It's more like converting a C program into C++ – and
even then, my gut feeling is that the minimal changes necessary to turn
a typical C program into valid C++ would be fewer changes per line than
the changes necessary to turn Python 2 into Python3.
My gut feeling was the same until I had to port code from python 2 to python
3. Requiring at least python 3.5 and using tools like modernize or futurize to
identify the parts where there could be problems reduced the work a lot.
Of course that good tests are a must since sometimes there are some issues
slipping under the radar. But on the whole the experience was easier than
expected and the resulting code has improved because of that.
Usual disclaimer: it depends on the code being ported and your mileage may
vary. :-)
--
José Abílio