Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/future/builtins/iterators.py: 67%
15 statements
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-25 06:53 +0000
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-25 06:53 +0000
1"""
2This module is designed to be used as follows::
4 from future.builtins.iterators import *
6And then, for example::
8 for i in range(10**15):
9 pass
11 for (a, b) in zip(range(10**15), range(-10**15, 0)):
12 pass
14Note that this is standard Python 3 code, plus some imports that do
15nothing on Python 3.
17The iterators this brings in are::
19- ``range``
20- ``filter``
21- ``map``
22- ``zip``
24On Python 2, ``range`` is a pure-Python backport of Python 3's ``range``
25iterator with slicing support. The other iterators (``filter``, ``map``,
26``zip``) are from the ``itertools`` module on Python 2. On Python 3 these
27are available in the module namespace but not exported for * imports via
28__all__ (zero no namespace pollution).
30Note that these are also available in the standard library
31``future_builtins`` module on Python 2 -- but not Python 3, so using
32the standard library version is not portable, nor anywhere near complete.
33"""
35from __future__ import division, absolute_import, print_function
37import itertools
38from future import utils
40if not utils.PY3:
41 filter = itertools.ifilter
42 map = itertools.imap
43 from future.types import newrange as range
44 zip = itertools.izip
45 __all__ = ['filter', 'map', 'range', 'zip']
46else:
47 import builtins
48 filter = builtins.filter
49 map = builtins.map
50 range = builtins.range
51 zip = builtins.zip
52 __all__ = []