@@ -20,7 +20,7 @@ Features
2020- provides backports and remappings for 15 builtins with different
2121 semantics on Py3 versus Py2
2222- provides backports and remappings from the Py3 standard library
23- - 300 + unit tests
23+ - 330 + unit tests
2424- ``futurize `` script based on ``2to3 ``, ``3to2 `` and parts of
2525 ``python-modernize `` for automatic conversion from either Py2 or Py3 to a
2626 clean single-source codebase compatible with Python 2.6+ and Python 3.3+.
@@ -33,24 +33,12 @@ Code examples
3333-------------
3434
3535``future `` is designed to be imported at the top of each Python module
36- together with Python's built-in ``__future__ `` module like this::
37-
38- from __future__ import (absolute_import, division,
39- print_function, unicode_literals)
40- from future import standard_library
41- from future.builtins import *
36+ together with Python's built-in ``__future__ `` module. For example, this
37+ code behaves the same way on Python 2.6/2.7 after these imports as it does
38+ on Python 3::
4239
43- followed by standard Python 3 code. The imports have no effect on Python
44- 3 but allow the code to run mostly unchanged on Python 3 and Python 2.6/2.7.
45-
46- For example, this code behaves the same way on Python 2.6/2.7 after these
47- imports as it normally does on Python 3::
48-
49- # Support for renamed standard library modules via import hooks
50- from http.client import HttpConnection
51- from itertools import filterfalse
52- import html.parser
53- import queue
40+ from __future__ import absolute_import, division, print_function
41+ from future import bytes, str, open, super, zip, round, input, int
5442
5543 # Backported Py3 bytes object
5644 b = bytes(b'ABCD')
@@ -98,8 +86,21 @@ imports as it normally does on Python 3::
9886 # Compatible output from isinstance() across Py2/3:
9987 assert isinstance(2**64, int) # long integers
10088 assert isinstance(u'blah', str)
101- assert isinstance('blah', str) # with unicode_literals in effect
102- assert isinstance(b'bytestring', bytes)
89+ assert isinstance('blah', str) # if unicode_literals is in effect
90+
91+ There is also support for renamed standard library modules in the form of import hooks::
92+
93+ from future import standard_library
94+ standard_library.install_hooks()
95+
96+ from http.client import HttpConnection
97+ from itertools import filterfalse
98+ import html.parser
99+ import queue
100+
101+ To disable these at the end of a module, use::
102+
103+ standard_library.remove_hooks()
103104
104105
105106Documentation
@@ -114,16 +115,7 @@ Credits
114115:Author: Ed Schofield
115116:Sponsor: Python Charmers Pty Ltd, Australia, and Python Charmers Pte
116117 Ltd, Singapore. http://pythoncharmers.com
117- :Others: - The backported ``super() `` and ``range() `` functions are
118- derived from Ryan Kelly's ``magicsuper `` module and Dan
119- Crosta's ``xrange `` module.
120- - The ``futurize `` script uses ``lib2to3 ``, ``lib3to2 ``, and
121- parts of Armin Ronacher's ``python-modernize `` code.
122- - The ``python_2_unicode_compatible `` decorator is from
123- Django. The ``implements_iterator `` and ``with_metaclass ``
124- decorators are from Jinja2.
125- - Documentation is generated using ``sphinx `` using
126- ``sphinx_bootstrap_theme ``.
118+ :Others: See http://python-future.org/credits.html
127119
128120
129121Licensing
0 commit comments