[Imported from Trac: page Python3, version 14]

itamarst 2020-08-05 15:49:18 +00:00
parent 8c42bc8a63
commit 0bfdfb8e55

@ -58,7 +58,7 @@ And replace the `from builtins import *` variant, if any, with:
```#!python
from future.utils import PY2
if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, int, list, object, range, str, max, min # noqa: F401
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
```
### When things get complicated
@ -94,7 +94,7 @@ One of them is the `bytes` objects:
## Don't leak Future objects
Leaking Future objects (newints, new dicts, new bytes) in module API can break existing code on Python 2. So need to be careful not to do that. For that reason int isn't in the suggested list above.
Leaking Future objects (newints, new dicts, new bytes) in module API can break existing code on Python 2. So need to be careful not to do that. For that reason int isn't in the suggested `from builtins import ...` list above.
## Other notes