8000 Add note discouraging selective imports from future.builtins · thecodingchicken/python-future@0193ca5 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 0193ca5

Browse files
committed
Add note discouraging selective imports from future.builtins
1 parent 3b56c09 commit 0193ca5

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

docs/source/imports.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ These are all available in Python 2.6 and up, and mandatory in Python 3+.
4545

4646
Explicit imports
4747
~~~~~~~~~~~~~~~~
48+
4849
If you prefer explicit imports, the explicit equivalent of the ``from
4950
future.builtins import *`` line is::
5051

@@ -53,7 +54,10 @@ future.builtins import *`` line is::
5354
str, bytes, range, round, super,
5455
apply, cmp, coerce, execfile, file, long,
5556
raw_input, reduce, reload, unicode, xrange,
56-
str, StandardError)
57+
StandardError)
58+
59+
However, we discourage importing only some of these builtins because this
60+
increases the risk of introducing Py2/3 portability bugs into your code.
5761

5862
To understand what each of these does, see the docs for these modules:
5963

@@ -65,13 +69,13 @@ To understand what each of these does, see the docs for these modules:
6569

6670
The internal API is currently as follows::
6771

68-
from future.builtins.iterators import zip, map, filter
69-
from future.builtins.misc import ascii, oct, hex, chr, int, input, open
70-
from future.builtins.backports import str, bytes, range, round, super
72+
from future.builtins.iterators import filter, map, zip
73+
from future.builtins.misc import ascii, chr, hex, input, int, oct, open
74+
from future.builtins.backports import bytes, range, round, str, super
7175
from future.builtins.disabled import (apply, cmp, coerce,
7276
execfile, file, long, raw_input, reduce, reload, unicode,
7377
xrange, StandardError)
7478

75-
But please note that this internal API may not be stable between
76-
different versions of ``future``.
79+
But please note that this internal API is evolving and may not be stable
80+
between different versions of ``future``.
7781

0 commit comments

Comments
 (0)
0