On 17/06/2019 15.14, Igor Korot wrote: > Hi, > Is there a place where there is a full list of incompatibilities between > python 2 and python 3 is available and how to fix them?
‘What’s new in Python 3.0’ is a good starting point https://docs.python.org/3/whatsnew/3.0.html It doesn’t list all standard library changes, but it has the most important ones. Obviously it can't include anything that third-party modules do. The main incompatibility is obviously strings, and there various modules have adopted different strategies for the transition. > > I'm looking for a way to fix following code, which runs perfectly with python > 2 > (and make it work with both python 2 and python 3): > > if bytes[0:16].tostring() != '<some_string>': No idea what this is supposed to do as you didn't say what ‘bytes’ was. I could imagine that the tostring() method returns a bytes rather than a str… Also, ‘bytes’ is the name of a built-in type in Python3. You don't want to use that as a variable name any more! (You can, though) > I know there are automated tools that can help you do the upgrade, but > automated tools can do only so much.... By many accounts, 2to3 doesn't work very well in the real world, at least not any more. > > And I am not sure if they can just add python 3 code and include version > check. > > Thank you. -- https://mail.python.org/mailman/listinfo/python-list