3 ms·
There are converters, and it's not too difficult to even write code that runs in both Python 2 and 3. The main roadblock in upgrades is unicode text vs bytes h
by ProblemFactory 11y ago
There are converters, and it's not too difficult to even write code that runs in both Python 2 and 3.
The main roadblock in upgrades is unicode text vs bytes handling.
Python2 was lax about using bytes for text. You could do unicode and bytes properly if you really tried hard enough, but it took a conscious effort. So most people just used bytes for text, and hoped for the best (if the data is ASCII or UTF-8, it will work most of the time).
Python3 is strict about the text vs bytes separation. Patching this into a program afterwards is a lot of work.
But if your Python2 program already does unicode carefully in Python2 (unicode type internally everywhere, from __future__ import unicode_literals, explicit encode/decode when talking to external APIs), then you are 90% done with the upgrade to Python3.