O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

__future__

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 featurename

at the top of a source file that uses the feature.

Currently, the following features have been defined:

nested_scopes

Support for nested scopes in functions. First introduced in Python 2.1 and made the default behavior in Python 2.2.

generators

Support for generators. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required