OLD | NEW |
(Empty) | |
| 1 """ |
| 2 A module that brings in equivalents of the new and modified Python 3 |
| 3 builtins into Py2. Has no effect on Py3. |
| 4 |
| 5 See the docs `here <http://python-future.org/what-else.html>`_ |
| 6 (``docs/what-else.rst``) for more information. |
| 7 |
| 8 """ |
| 9 |
| 10 from future.builtins.iterators import (filter, map, zip) |
| 11 # The isinstance import is no longer needed. We provide it only for |
| 12 # backward-compatibility with future v0.8.2. It will be removed in future v1.0. |
| 13 from future.builtins.misc import (ascii, chr, hex, input, isinstance, next, |
| 14 oct, open, pow, round, super) |
| 15 from future.utils import PY3 |
| 16 |
| 17 if PY3: |
| 18 import builtins |
| 19 bytes = builtins.bytes |
| 20 dict = builtins.dict |
| 21 int = builtins.int |
| 22 list = builtins.list |
| 23 object = builtins.object |
| 24 range = builtins.range |
| 25 str = builtins.str |
| 26 __all__ = [] |
| 27 else: |
| 28 from future.types import (newbytes as bytes, |
| 29 newdict as dict, |
| 30 newint as int, |
| 31 newlist as list, |
| 32 newobject as object, |
| 33 newrange as range, |
| 34 newstr as str) |
| 35 from future import utils |
| 36 |
| 37 |
| 38 if not utils.PY3: |
| 39 # We only import names that shadow the builtins on Py2. No other namespace |
| 40 # pollution on Py2. |
| 41 |
| 42 # Only shadow builtins on Py2; no new names |
| 43 __all__ = ['filter', 'map', 'zip', |
| 44 'ascii', 'chr', 'hex', 'input', 'next', 'oct', 'open', 'pow', |
| 45 'round', 'super', |
| 46 'bytes', 'dict', 'int', 'list', 'object', 'range', 'str', |
| 47 ] |
| 48 |
| 49 else: |
| 50 # No namespace pollution on Py3 |
| 51 __all__ = [] |
OLD | NEW |