Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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.7 print() is available as a builtin but is masked by the print statement syntax, which can be disabled by entering from __future__ import print_function at the top of the file.

  • Removal of the Python 2 input function, and the renaming of the raw_input function to input. Python 3's input function behaves like Python 2's raw_input function, in that the input is always returned as a string rather than being evaluated as an expression.
  • Moving reduce (but not map or filter) out of the built-in namespace and into functools (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 immutable bytes type; and a mostly corresponding mutable bytearray 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 is 2; in Python 3, 5 / 2 is 2.5. (In both Python 2 (2.2 onwards) and Python 3, 5 // 2 is 2).
  • 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.

...