Part of my work in different companies has been about the transition fromp python2 to python3
This is the most obvious point of conflict. The old print “string” doesn’t work anymore.
New modules and classes names
A few of the libraries that come with python have changed their name to something else That affects to the oneliners too, like the http server.
String and Unicode
from __future__ import unicode_literals converts all the literal strings to unicode. This might break some stuff.
String and bytes
most libraries use .decode and .encode to alter the meaning of a string. In python 3 strings are always encoded, and bytes are always decoded
Absolute imports as default
from __future__ import absolute_import makes python2 behave like python3
py2 division works like integer division when both parts are integers. Py3 returns a float.
from __future__ import division makes python2 behave like python3
py2 division when rounding middle values (0.5) rounds to the further away from 0 value.
round(0.5) will return
1.0. Python3 returns the banker division, returning the nearest to the even number.
0. It also fixes the odd behavior of returning float in all cases.