...
Changing
print
so that it is a built-in function, not a statement. This made it easier to change a module to use a different print function, as well as making the syntax more regular. In Python 2.6 and 2.7print()
is available as a builtin but is masked by the print statement syntax, which can be disabled by enteringfrom __future__ import print_function
at the top of the file.- Removal of the Python 2
input
function, and the renaming of theraw_input
function toinput
. Python 3'sinput
function behaves like Python 2'sraw_input
function, in that the input is always returned as a string rather than being evaluated as an expression. - Moving
reduce
(but notmap
orfilter
) out of the built-in namespace and intofunctools
(the rationale being that operations using reduce are expressed more clearly using an accumulation loop). - Adding support for optional function annotations that can be used for informal type declarations or other purposes.
- Unifying the
str
/unicode
types, representing text, and introducing a separate immutablebytes
type; and a mostly corresponding mutablebytearray
type, both of which represent arrays of bytes. - Removing backward-compatibility features, including old-style classes, string exceptions, and implicit relative imports.
- A change in integer division functionality: in Python 2,
5 / 2
is2
; in Python 3,5 / 2
is2.5
. (In both Python 2 (2.2 onwards) and Python 3,5 // 2
is2
). - map(function, iterable) changes from python2.7 to python3. In python2.7 map returns a list with the results of applying the function over the iterable, in python3 returns a map object, to retrieve the values, we can use list(map(function, iterable)
Subsequent releases in the Python 3.x series have included additional, substantial new features; all ongoing development of the language is done in the 3.x series.
...