February 2006
Intermediate to advanced
648 pages
14h 53m
English
The __future__ module is used to enable features that are new but not yet turned on by default. Typically these features change an important aspect of the Python interpreter that could potentially break a lot of old code if they were turned on right away. Therefore, new features are introduced gradually—first as optional features and then as standard features in later releases.
Optional features are enabled by including a statement such as
from __future__ import featurenameat the top of a source file that uses the feature.
Currently, the following features have been defined:
nested_scopesSupport for nested scopes in functions. First introduced in Python 2.1 and made the default behavior in Python 2.2.
generatorsSupport for generators. ...
Read now
Unlock full access