Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/future/builtins/iterators.py @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
| author | shellac |
|---|---|
| date | Sat, 02 May 2020 07:14:21 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:26e78fe6e8c4 |
|---|---|
| 1 """ | |
| 2 This module is designed to be used as follows:: | |
| 3 | |
| 4 from future.builtins.iterators import * | |
| 5 | |
| 6 And then, for example:: | |
| 7 | |
| 8 for i in range(10**15): | |
| 9 pass | |
| 10 | |
| 11 for (a, b) in zip(range(10**15), range(-10**15, 0)): | |
| 12 pass | |
| 13 | |
| 14 Note that this is standard Python 3 code, plus some imports that do | |
| 15 nothing on Python 3. | |
| 16 | |
| 17 The iterators this brings in are:: | |
| 18 | |
| 19 - ``range`` | |
| 20 - ``filter`` | |
| 21 - ``map`` | |
| 22 - ``zip`` | |
| 23 | |
| 24 On Python 2, ``range`` is a pure-Python backport of Python 3's ``range`` | |
| 25 iterator with slicing support. The other iterators (``filter``, ``map``, | |
| 26 ``zip``) are from the ``itertools`` module on Python 2. On Python 3 these | |
| 27 are available in the module namespace but not exported for * imports via | |
| 28 __all__ (zero no namespace pollution). | |
| 29 | |
| 30 Note that these are also available in the standard library | |
| 31 ``future_builtins`` module on Python 2 -- but not Python 3, so using | |
| 32 the standard library version is not portable, nor anywhere near complete. | |
| 33 """ | |
| 34 | |
| 35 from __future__ import division, absolute_import, print_function | |
| 36 | |
| 37 import itertools | |
| 38 from future import utils | |
| 39 | |
| 40 if 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'] | |
| 46 else: | |
| 47 import builtins | |
| 48 filter = builtins.filter | |
| 49 map = builtins.map | |
| 50 range = builtins.range | |
| 51 zip = builtins.zip | |
| 52 __all__ = [] |
