Reply to post: Re: Why didn't they...

For real this time, get your butt off Python 2: No updates, no nothing after 1 January 2020

Tom 38 Silver badge

Re: Why didn't they...

futurize, from python-futures is a better bet. I maintain many 2/3 compatible libraries, even some with C extensions, the trick is to make python 3 code that also works in 2.

Python 3 is clearly better to work in than 2. Once you have good Python 3 code, getting that to work in Python 2 is quite straightforward, simply because of the design choices of 3. You have to know where in your program you are dealing with strings, and where in your code you are writing or reading bytes. Those bits with bytes always happen at disk or IO points.

Lots of Python 2 code is poor at these points - ever see mojibake or UnicodeDecodeError/UnicodeEncodeError? - and Python 3 is just not. Even if you don't switch to 3 just yet, making the code Python 2/3 compatible invariably means making it better to run on 2.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon


Biting the hand that feeds IT © 1998–2021