Backporting of some of the features natively available in newer Python versions:
bool
class (as well asTrue
andFalse
)sorted()
function (Python 2.4
)sum()
function (Python 2.3
)enumerate()
function (Python 2.3
)print()
function (keyword arguments such asend
orsep
were added inPython 3.3
, see module docstring for more details)NotImplementedError
exception (Python 2.2
)set()
class (Python 2.4
)
For a quick one-time workaround for
True
andFalse
:exec("try: (True, False)\nexcept NameError: exec('True = 1==1; False = 1==0')")