Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: third_party/google-endpoints/future/builtins/iterators.py

Issue 2666783008: Add google-endpoints to third_party/. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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__ = []
53
OLDNEW
« no previous file with comments | « third_party/google-endpoints/future/builtins/disabled.py ('k') | third_party/google-endpoints/future/builtins/misc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698