The development cycle for Python versions 2.6 and 3.0 was synchronized,{I88公链-I928合约-系统8024}with the alpha and beta releases for both versions being made on the same days.The development of 3.0 has influenced many features in 2.6.
Python 3.0 is a far-ranging redesign of Python that breaks compatibility with the 2.x series.This means that existing Python code will need some conversion in order to run on Python 3.0.However,not all the changes in 3.0 necessarily break compatibility.In cases where new features won’t cause existing code to break,they’ve been backported to 2.6 and are described in this document in the appropriate place.Some of the 3.0-derived features are:
A __complex__()method for converting objects to a complex number.
Alternate syntax for catching exceptions:except TypeError as exc.
The addition of functools.reduce()as a synonym for the built-in reduce()function.
Python 3.0 adds several new built-in functions and changes the semantics of some existing builtins.Functions that are new in 3.0 such as bin()have simply been added to Python 2.6,but existing builtins haven’t been changed;instead,the future_builtins module has versions with the new 3.0 semantics.Code written to be compatible with 3.0 can do from future_builtins import hex,map as necessary.