We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3123776 commit 50f37feCopy full SHA for 50f37fe
itertools/itertools.py
@@ -0,0 +1,36 @@
1
+def count(start, step=1):
2
+ while True:
3
+ yield start
4
+ start += step
5
+
6
+def cycle(p):
7
8
+ yield from p
9
10
+def repeat(el, n=None):
11
+ if n is None:
12
13
+ yield el
14
+ else:
15
+ for i in range(n):
16
17
18
+def chain(*p):
19
+ for i in p:
20
+ yield from i
21
22
+def islice(p, start, stop=(), step=1):
23
+ if stop == ():
24
+ stop = start
25
+ start = 0
26
27
+ try:
28
+ yield p[start]
29
+ except IndexError:
30
+ return
31
32
+ if start >= stop:
33
34
35
+def tee(iterable, n=2):
36
+ return [iter(iterable)] * n
0 commit comments