Skip to content

Commit 7f10e74

Browse files
committed
Discourage use of future.standard_library.hooks in docs (issue #238)
1 parent 5cd9587 commit 7f10e74

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

docs/older_interfaces.rst

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,6 @@ the reorganized standard library. This is largely for historical reasons (for
99
versions prior to 0.14).
1010

1111

12-
Context-manager for import hooks
13-
________________________________
14-
15-
The context-manager interface is via a context-manager called ``hooks``::
16-
17-
from future.standard_library import hooks
18-
with hooks():
19-
import socketserver
20-
import queue
21-
import configparser
22-
import test.support
23-
import html.parser
24-
from collections import UserList
25-
from itertools import filterfalse, zip_longest
26-
from http.client import HttpConnection
27-
import urllib.request
28-
# and other moved modules and definitions
29-
30-
This interface is straightforward and effective, using PEP 302 import
31-
hooks.
32-
33-
3412
``future.moves`` interface
3513
__________________________
3614

@@ -92,8 +70,32 @@ functions from ``future.standard_library`` as follows::
9270
This interface also works with two-level imports.
9371

9472

95-
install_hooks() call
96-
____________________
73+
Context-manager for import hooks
74+
________________________________
75+
76+
The context-manager interface is via a context-manager called ``hooks``::
77+
78+
from future.standard_library import hooks
79+
with hooks():
80+
import socketserver
81+
import queue
82+
import configparser
83+
import test.support
84+
import html.parser
85+
from collections import UserList
86+
from itertools import filterfalse, zip_longest
87+
from http.client import HttpConnection
88+
import urllib.request
89+
# and other moved modules and definitions
90+
91+
This interface is straightforward and effective, using PEP 302 import
92+
hooks. However, there are reports that this sometimes leads to problems
93+
(see issue #238). Until this is resolved, it is probably safer to use direct
94+
imports or one of the other import mechanisms listed above.
95+
96+
97+
install_hooks() call (deprecated)
98+
_________________________________
9799

98100
The last interface to the reorganized standard library is via a call to
99101
``install_hooks()``::

0 commit comments

Comments
 (0)