6 ms·
I've used this module for upgrading a python2-only lib : https://pypi.python.org/pypi/future https://pypi.python.org/pypi/future . Basically it allow you to wri
by luch 10y ago
I've used this module for upgrading a python2-only lib : https://pypi.python.org/pypi/future https://pypi.python.org/pypi/future . Basically it allow you to write Python 3 code that will run on Python 2 interpreter (bar from using advanced features like coroutine or matrix mult operator).
Once you decide not to support Python2 anymore, just drop the imports. They also have a Py2/3 compat cheet sheet : http://python-future.org/compatible_idioms.pdf http://python-future.org/compatible_idioms.pdf
- daveguy 10y agoIt is pretty obvious there is a problem when your quick and easy cheat sheet is a 33 page tomb. If only Guido and company would acknowledge the problem and fix it instead of putting their fingers in their ears pretending Python 2 will cease to exist in 2020.
- wnoise 10y agoThey acknowledge the problem, and their solution is to stop actively aiding and abetting the people who are continuing to make it worse by writing python 2 code.
- nomel 10y agoWow, what a simplification. What about us who have and want to use massive libraries of existing Python 2 code? "Just upgrade your libraries!" is not realistic for everyone, especially those who have to justify a mostly idealogical conversion to a similar language, and spend real time and money, outside of actually developing the end product, to do it. Four more years of official support is a long time.
- takeda 10y agoSomeone suggested Cython to compile python 2 code as modules and import to python 3. Did not try it, but that sounds plausible.