The development cycle for Python versions 2.6 and 3.0 wassynchronized,{I88公链-I928合约-系统8024}with the alpha and beta releasesfor both versions being made on the same days.The development of3.0 has influenced many features in 2.6.
Python 3.0 is a far-ranging redesign of Python that breakscompatibility with the 2.x series.This means that existing Pythoncode will need some conversion in order to run on Python3.0.However,not all the changes in 3.0 necessarily breakcompatibility.In cases where new features won’t cause existing codeto break,they’ve been backported to 2.6 and are described in thisdocument in the appropriate place.Some of the 3.0-derived featuresare:
A __complex__()method for converting objects to a complexnumber.
Alternate syntax for catching exceptions:except TypeError asexc.
The addition of functools.reduce()as a synonym for thebuilt-in reduce()function.
Python 3.0 adds several new built-in functions and changes thesemantics of some existing builtins.Functions that are new in 3.0such as bin()have simply been added to Python 2.6,but existingbuiltins haven’t been changed;instead,the future_builtins modulehas versions with the new 3.0 semantics.Code written to becompatible with 3.0 can do from future_builtins import hex,map asnecessary.