[docs] [issue14845] list(<generator expression>) != [<list comprehension>]

Wolfgang Maier report at bugs.python.org
Tue Nov 29 03:46:42 EST 2016


Wolfgang Maier added the comment:

running with "-W always":

>>> def five(x):
...     for _ in range(5):
...         yield x
... 

>>> F = five('x')

>>> [next(F) for _ in range(10)]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <listcomp>
StopIteration

>>> list(next(F) for _ in range(10))
__main__:1: DeprecationWarning: generator '<genexpr>' raised StopIteration
[]

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14845>
_______________________________________


More information about the docs mailing list