From: Georg Brandl Date: Mon, 15 Dec 2008 08:29:32 +0000 (+0000) Subject: #4668: wrap iterator returns in list() in functional howto. X-Git-Tag: v3.1a1~698 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a3deea13127f8870f5417cd128de46d161a6f54b;p=python #4668: wrap iterator returns in list() in functional howto. --- diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst index 4dea527938..47798e9e11 100644 --- a/Doc/howto/functional.rst +++ b/Doc/howto/functional.rst @@ -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]