Skip to content

Commit c8e2a35

Browse files
committed
Update docs
1 parent 4e5ba3d commit c8e2a35

File tree

2 files changed

+73
-14
lines changed

2 files changed

+73
-14
lines changed

docs/standard_library_imports.rst

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ the standard Python 3 names and locations, it provides access to either the
88
corresponding native standard library modules (``future.moves``) or to backported
99
modules from Python 3.3 (``future.backports``).
1010

11-
.. _list-standard-library-moves:
11+
.. _list-standard-library-renamed:
1212

1313
List of renamed standard library modules
1414
----------------------------------------
@@ -28,7 +28,6 @@ modules under their Python 3.x interfaces. The following renamed modules can be
2828
import html.entities
2929
import html.parser
3030

31-
import http
3231
import http.client
3332
import http.cookies
3433
import http.cookiejar
@@ -40,7 +39,17 @@ modules under their Python 3.x interfaces. The following renamed modules can be
4039

4140
import socketserver
4241

43-
from tkinter import ...
42+
from tkinter import colorchooser
43+
from tkinter import commondialog
44+
from tkinter import constants
45+
from tkinter import dialog
46+
from tkinter import dnd
47+
from tkinter import filedialog
48+
from tkinter import font
49+
from tkinter import messagebox
50+
from tkinter import scrolledtext
51+
from tkinter import simpledialog
52+
from tkinter import tix
4453

4554
import winreg # Windows only
4655

@@ -52,30 +61,28 @@ modules under their Python 3.x interfaces. The following renamed modules can be
5261
import _thread
5362

5463

64+
.. _list-standard-library-refactored:
65+
5566
List of refactored standard library modules
5667
-------------------------------------------
5768

5869
Some modules were refactored or extended from Python 2.6/2.7 to
5970
3.x but were neither renamed nor were the new interfaces backported. The
6071
``future`` package makes the Python 3.x interfaces available on Python
61-
2.x after running::
62-
63-
from future.standard_library import install_aliases
64-
install_aliases()
65-
66-
Then the following additional imports work in Python 2/3 compatible code::
72+
2.x using one of four interfaces described below. Then the following additional
73+
modules and names are supported::
6774

6875
from collections import Counter, OrderedDict # backported to Py2.6
6976
from collections import UserDict, UserList, UserString
7077

7178
import dbm
7279
import dbm.dumb
73-
import dbm.gnu
74-
import dbm.ndbm
80+
import dbm.gnu # requires Python dbm support
81+
import dbm.ndbm # requires Python dbm support
7582

7683
from itertools import filterfalse, zip_longest
7784

78-
from subprocess import check_output # backported to Py2.6
85+
from subprocess import check_output # backported to Py2.6
7986
from subprocess import getoutput, getstatusoutput
8087

8188
from sys import intern
@@ -158,8 +165,8 @@ follows::
158165
install_hooks() call
159166
~~~~~~~~~~~~~~~~~~~~
160167

161-
The fourth interface to the reorganized standard library is via an
162-
explicit call to ``install_hooks()``::
168+
The fourth interface to the reorganized standard library is via a
169+
call to ``install_hooks()``::
163170

164171
from future import standard_library
165172
standard_library.install_hooks()

docs/whatsnew.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,58 @@
33
What's New
44
**********
55

6+
What's new in version 0.14.0
7+
============================
8+
9+
This is a major new release that offers a cleaner interface for most imports in
10+
Python 2/3 compatible code.
11+
12+
Instead of this interface::
13+
14+
>>> from future.builtins import str, open, range, dict
15+
16+
>>> from future.standard_library import hooks
17+
>>> with hooks():
18+
... import queue
19+
... import configparser
20+
... import tkinter.dialog
21+
... # etc.
22+
23+
Python 2/3 compatible code can now use the following interface::
24+
25+
>>> # Alias for future.builtins on Py2:
26+
>>> from builtins import str, open, range, dict
27+
28+
>>> # Alias for future.moves.* on Py2:
29+
>>> import queue
30+
>>> import configparser
31+
>>> import tkinter.dialog
32+
>>> etc.
33+
34+
Of the 44 modules that were refactored with PEP 3108 (standard library
35+
reorganization), 30 are supported with direct imports. (These are listed here:
36+
:ref:`_list-standard-library-renamed`.)
37+
38+
The other 14 standard library modules that kept the same top-level names in
39+
Py3.x are not supported with this direct import interface on Py2. These include
40+
the 5 modules in the Py3 ``urllib`` package. (These are listed here:
41+
:ref:`_list-standard-library-refactored`.) These are accessible through the usual
42+
mechanisms::
43+
44+
>>> from future.standard_library import hooks
45+
>>> with hooks():
46+
... from collections import UserDict, UserList, UserString
47+
... import dbm.gnu
48+
... from itertools import filterfalse, zip_longest
49+
... from subprocess import getoutput, getstatusoutput
50+
... from sys import intern
51+
... import test.support
52+
... from urllib.request import urlopen
53+
... from urllib.parse import urlparse
54+
... # etc.
55+
... from collections import Counter, OrderedDict # backported to Py2.6
56+
57+
658
What's new in version 0.13.2
759
============================
860

0 commit comments

Comments
 (0)