[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 22/01/2019 19:00, Schachner, Joseph wrote:
> For anyone who has moved a substantial bunch of Python 2 to Python 3,   can you please reply with your experience?  Did you run into any issues?   Did 2to3 do its job well, or did you have to review its output to eliminate some working but silly thing?
I did the port of reportlab (www.reportlab.com) from  code supporting 2.x only x>=3 to a version which supported 2.7.z & >=3.3. 
The reportlab toolkit was then about 14 years old and had (and still has lots of cruft). The port effort began 20130215 and ended 
20140326 ie 13 months. There were 333 commits on the branch. I used 2to3, but not six. Because we needed to maintain 2.7 and >=3.3 
there were quite a few issues related to simple things like iterkeys/values/items <--> keys/values/items removal of xrange etc etc.

Maintaining compatible extensions is also hard. Pdf production requires byte output and was already quite messy because reportlab 
supported both utf8 and unicode inputs; it hasn't got a lot easier.

As for performance the 3.x runs were generally slower than 2.7, but I think that situation has changed with 3.6 & 3.7 (for the 
reportlab tests on windows 2.7 takes 68.7", 3.4 83.8", 3.5 77.0", 3.6 61.5" & 3.7 60.9").

At some point reportlab will be made 3.x only which will require more effort.
Robin Becker