]> granicus.if.org Git - python/commitdiff
#4668: wrap iterator returns in list() in functional howto.
authorGeorg Brandl <georg@python.org>
Mon, 15 Dec 2008 08:29:32 +0000 (08:29 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 15 Dec 2008 08:29:32 +0000 (08:29 +0000)
Doc/howto/functional.rst

index 4dea527938ef35d1371724585f740065b2cf75f9..47798e9e11845f2dd7d1a6e077fdaf954168b971 100644 (file)
@@ -634,7 +634,7 @@ features of generator expressions:
     ...     return s.upper()
 
 
-    >>> map(upper, ['sentence', 'fragment'])
+    >>> list(map(upper, ['sentence', 'fragment']))
     ['SENTENCE', 'FRAGMENT']
     >>> [upper(s) for s in ['sentence', 'fragment']]
     ['SENTENCE', 'FRAGMENT']
@@ -650,7 +650,7 @@ value.
     >>> def is_even(x):
     ...     return (x % 2) == 0
 
-    >>> filter(is_even, range(10))
+    >>> list(filter(is_even, range(10)))
     [0, 2, 4, 6, 8]