@@ -5,11 +5,15 @@ Standard library imports
55
66:mod: `future ` supports the standard library reorganization (PEP 3108). Under
77the standard Python 3 names and locations, it provides access to either the
8- corresponding native standard library modules (``future.moves ``) or backported
9- modules from Python 3.3 on Python 2 (``future.standard_library ``).
8+ corresponding native standard library modules (``future.moves ``) or to backported
9+ modules from Python 3.3 (``future.standard_library ``).
1010
11- There are four interfaces to the reorganized standard library. The
12- first is via a context-manager called ``hooks ``::
11+ There are currently four interfaces to the reorganized standard library.
12+
13+
14+ Context-manager interface
15+ -------------------------
16+ The first interface is via a context-manager called ``hooks ``::
1317
1418 from future import standard_library
1519 with standard_library.hooks():
@@ -23,6 +27,9 @@ first is via a context-manager called ``hooks``::
2327 from http.client import HttpConnection
2428 # and other moved modules and definitions
2529
30+ Direct interface
31+ ----------------
32+
2633The second interface avoids import hooks. It may therefore be more
2734robust, at the cost of less idiomatic code. Use it as follows::
2835
@@ -45,7 +52,11 @@ an underscore::
4552
4653 import future.standard_library.http.client as http_client
4754
48- The other workaround is to use the ``import_ `` and ``from_import `` functions as
55+ ``import_ `` and ``from_import `` functions
56+ -----------------------------------------
57+
58+ A third option, which also works with two-level imports, is to use the
59+ ``import_ `` and ``from_import `` functions from ``future.standard_library `` as
4960follows::
5061
5162 from future.standard_library import import_, from_import
@@ -55,8 +66,10 @@ follows::
5566
5667 urlopen, urlsplit = from_import('urllib.request', 'urlopen', 'urlsplit')
5768
69+ ``install_hooks() `` call
70+ ------------------------
5871
59- The third (deprecated) interface to the reorganized standard library is via an
72+ The fourth (deprecated) interface to the reorganized standard library is via an
6073explicit call to ``install_hooks ``::
6174
6275 from future import standard_library
@@ -108,7 +121,7 @@ manager or one of the other import mechanisms (see above).
108121 List of standard library modules
109122________________________________
110123
111- The modules available are::
124+ The modules available via `` future.moves `` are::
112125
113126 import socketserver
114127 import queue
@@ -125,11 +138,6 @@ The modules available are::
125138 import http.server
126139 import http.cookies
127140 import http.cookiejar
128-
129- .. Disabled: import test.support
130-
131- Backports of the following modules are currently not supported, but we aim to support them in
132- the future::
133141
134142 import urllib
135143 import urllib.parse
@@ -139,5 +147,19 @@ the future::
139147 import xmlrpc.client
140148 import xmlrpc.server
141149
142- If you need one of these, please open an issue `here <https://github.com/PythonCharmers/python-future >`_.
150+ .. Disabled: import test.support
151+
152+ Backports
153+ ~~~~~~~~~
154+
155+ Backports of the following modules from Python 3.3's standard library to Python 2.x are also
156+ currently available in ``future.standard_library `` but of alpha quality::
157+
158+ http.server
159+ urllib
160+ xmlrpc.client
161+ xmlrpc.server
162+
163+ If you need the full backport of one of these, please open an issue `here
164+ <https://github.com/PythonCharmers/python-future> `_.
143165
0 commit comments