Skip to main content

future is the missing compatibility layer between Python 3 and Python 2. It allows you to use a single, clean Python 3.x-compatible codebase to support both Python 3 and Python 2 with minimal overhead.

Notable projects that use future for Python 2/3 compatibility are Mezzanine and ObsPy.

It is designed to be used as follows:

from __future__ import (absolute_import, division,
                        print_function, unicode_literals)
from future.builtins import (
                bytes, dict, int, list, object, range, str,
                ascii, chr, hex, input, next, oct, open,
                pow, round, super,
                filter, map, zip)

followed by predominantly standard, idiomatic Python 3 code that then runs similarly on Python 2.6/2.7 and Python 3.3+.

The imports have no effect on Python 3. On Python 2, they shadow the corresponding builtins, which normally have different semantics on Python 3 versus 2, to provide their Python 3 semantics.

Standard library reorganization

from future import standard_library provides a context-manager called hooks that installs import hooks (PEP 3108) to allow renamed and moved standard library modules to be imported from their new Py3 locations.

Automatic conversion

An included script called futurize aids in converting code (from either Python 2 or Python 3) to code compatible with both platforms. It is similar to python-modernize but goes further in providing Python 3 compatibility through the use of the backported types and builtin functions in future.

Documentation

See: http://python-future.org

Credits

Author:

Ed Schofield

Sponsor:

Python Charmers Pty Ltd, Australia, and Python Charmers Pte Ltd, Singapore. http://pythoncharmers.com

Others:

See docs/credits.rst or http://python-future.org/credits.html

Licensing

Copyright 2013-2014 Python Charmers Pty Ltd, Australia. The software is distributed under an MIT licence. See LICENSE.txt.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

future-0.13.1.tar.gz (893.4 kB view details)

Uploaded Source

File details

Details for the file future-0.13.1.tar.gz.

File metadata

  • Download URL: future-0.13.1.tar.gz
  • Upload date:
  • Size: 893.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for future-0.13.1.tar.gz
Algorithm Hash digest
SHA256 6e91722eaec7d9324ac1060858f5211f822fea698b1f88492aa91d08fc2a62e2
MD5 b6ab8aafb3b76c6e93d4d9de87210a88
BLAKE2b-256 b4e607e207c894654762689a37c1b697c16aee1360df6eeafcbd66d3a16b9812

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

2 files

0.18.3

1 file

0.18.2

1 file

0.18.1

1 file

0.18.0

3 files

0.17.1

1 file

0.17.0

1 file

0.16.0

1 file

0.15.2

1 file

0.15.1

1 file

0.15.0

1 file

0.14.3

1 file

0.14.2

1 file

0.14.1

1 file

0.14.0

1 file

This release

0.13.1 This release

1 file

0.13.0

1 file

0.12.4

1 file

0.12.3

1 file

0.12.2

1 file

0.12.1

1 file

0.12.0

1 file

0.11.4

1 file

0.11.3

1 file

0.11.2

1 file

0.11.1

1 file

0.11.0

1 file

0.10.2

1 file

0.10.1

1 file

0.10.0

1 file

0.9.0

1 file

0.8.2

1 file

0.8.1

1 file

0.8.0

1 file

0.7.0

1 file

0.6.0

1 file

0.5.2

1 file

0.5.1

1 file

0.5.0

1 file

0.4.1

1 file

0.4.0

1 file

0.3.5

1 file

0.3.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.0

1 file

0.1.0

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page