The __future__
module was introduced in Python 2.1 in order to have access to upcoming features/functions which will lead to incompatibilities with the current implementation and is extended with each version if needed.
So the module gives the possibility to use those incompatible functions of future versions in earlier versions. So you can make use of the upcoming advantages of those functions.
There are three main reasons for that module as stated in the docs:
__future__
is a real module, and serves three purposes:
- To avoid confusing existing tools that analyze import statements and
expect to find the modules they’re importing.
- To ensure that future
statements run under releases prior to 2.1 at least yield runtime
exceptions (the import of
__future__
will fail, because there was no
module of that name prior to 2.1).
- To document when incompatible
changes were introduced, and when they will be — or were — made
mandatory. This is a form of executable documentation, and can be
inspected programmatically via importing
__future__
and examining its
contents.