@@ -859,10 +859,6 @@ and :term:`generators <generator>` which incur interpreter overhead.
859859 # prepend(1, [2, 3, 4]) → 1 2 3 4
860860 return chain([value], iterable)
861861
862- def tabulate(function, start=0):
863- "Return function(0), function(1), ..."
864- return map(function, count(start))
865-
866862 def running_mean(iterable):
867863 "Yield the cumulative arithmetic mean."
868864 # running_mean([8.5, 9.5, 7.5, 7.0]) -> 8.5 9.0 8.5 8.0
@@ -1241,10 +1237,6 @@ and :term:`generators <generator>` which incur interpreter overhead.
12411237 [(0, 'a'), (1, 'b'), (2, 'c')]
12421238
12431239
1244- >>> list (islice(tabulate(lambda x : 2 * x), 4 ))
1245- [0, 2, 4, 6]
1246-
1247-
12481240 >>> list (running_median([8.5 , 9.5 , 7.5 , 7.0 ]))
12491241 [8.5, 9.0, 8.5, 8.0]
12501242
@@ -1813,6 +1805,10 @@ and :term:`generators <generator>` which incur interpreter overhead.
18131805
18141806 # Old recipes and their tests which are guaranteed to continue to work.
18151807
1808+ def tabulate(function, start=0):
1809+ "Return function(0), function(1), ..."
1810+ return map(function, count(start))
1811+
18161812 def old_sumprod_recipe(vec1, vec2):
18171813 "Compute a sum of products."
18181814 return sum(starmap(operator.mul, zip(vec1, vec2, strict=True)))
@@ -1892,6 +1888,10 @@ and :term:`generators <generator>` which incur interpreter overhead.
18921888.. doctest ::
18931889 :hide:
18941890
1891+ >>> list (islice(tabulate(lambda x : 2 * x), 4 ))
1892+ [0, 2, 4, 6]
1893+
1894+
18951895 >>> dotproduct([1 ,2 ,3 ], [4 ,5 ,6 ])
18961896 32
18971897
0 commit comments