Skip to content

Commit d6973c2

Browse files
committed
Update docs for new backported features from Py3.4
1 parent 42667ac commit d6973c2

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

docs/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ to be accessed under their Python 3 names and locations in Python 2::
102102
import queue
103103
import configparser
104104
from collections import UserDict, UserList, UserString
105-
from collections import Counter, OrderedDict # even on Py2.6
105+
from collections import Counter, OrderedDict, ChainMap # even on Py2.6
106106
from itertools import filterfalse, zip_longest
107107

108108
import html

docs/standard_library_imports.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ package makes the Python 3.x APIs available on Python 2.x as follows::
105105

106106
from sys import intern
107107

108-
from math import ceil # now returns an int
109-
110108
import test.support
111109

112110
import urllib.error
@@ -116,20 +114,26 @@ package makes the Python 3.x APIs available on Python 2.x as follows::
116114
import urllib.robotparser
117115

118116

119-
Backports also exist of the following features from Python 2.7+ for Python 2.6:
117+
Backports also exist of the following features from Python 3.4:
120118

121-
- collections.Counter
122-
- collections.OrderedDict
123-
- itertools.count (with an optional step parameter)
119+
- ``math.ceil`` returns an int on Py3
120+
- ``collections.OrderedDict`` (for Python 2.6)
121+
- ``collections.Counter`` (for Python 2.6)
122+
- ``collections.ChainMap`` (for all versions prior to Python 3.3)
123+
- ``itertools.count`` (for Python 2.6, with step parameter)
124+
- ``subprocess.check_output`` (for Python 2.6)
125+
- ``reprlib.recursive_repr``
124126

125-
These can be imported on Python 2.6 as follows::
127+
These can then be imported on Python 2.6+ as follows::
126128

127129
from future.standard_library import install_aliases
128130
install_aliases()
129131

130-
from collections import Counter, OrderedDict
132+
from math import ceil # now returns an int
133+
from collections import Counter, OrderedDict, ChainMap
131134
from itertools import count
132135
from subprocess import check_output
136+
from reprlib import recursive_repr
133137

134138

135139
External standard-library backports

docs/whatsnew.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Minor features:
1717
- ``collections.ChainMap`` backport (issue #150)
1818
- ``itertools.count`` backport for Py2.6 (issue #152)
1919
- Add constants to ``http.client`` such as ``HTTP_PORT`` and ``BAD_REQUEST`` (issue #137)
20+
- ``reprlib.recursive_repr`` backport for Py2
21+
- Update backports of ``Counter`` and ``OrderedDict`` to use Py3.4 implementations. This fixes ``.copy()`` for subclasses etc.
2022

2123
Bug fixes:
2224

src/future/backports/misc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Miscellaneous function (re)definitions from the Py3.3+ standard library
2+
Miscellaneous function (re)definitions from the Py3.4+ standard library
33
for Python 2.6/2.7.
44
55
- math.ceil (for Python 2.7)
@@ -8,6 +8,7 @@
88
- collections.ChainMap (for all versions prior to Python 3.3)
99
- itertools.count (for Python 2.6, with step parameter)
1010
- subprocess.check_output (for Python 2.6)
11+
- reprlib.recursive_repr (for Python 2.6+)
1112
"""
1213

1314
import subprocess

src/future/standard_library/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@
197197
('collections', 'OrderedDict', 'future.backports.misc', 'OrderedDict'),
198198
('collections', 'Counter', 'future.backports.misc', 'Counter'),
199199
('itertools', 'count', 'future.backports.misc', 'count'),
200+
('reprlib', 'recursive_repr', 'future.backports.misc', 'recursive_repr'),
200201

201202
# This is no use, since "import urllib.request" etc. still fails:
202203
# ('urllib', 'error', 'future.moves.urllib', 'error'),

0 commit comments

Comments
 (0)