[issue10544] yield expression inside generator expression does nothing
Serhiy Storchaka
report at bugs.python.org
Mon Nov 27 06:20:19 EST 2017
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
Note that the DeprecationWarning exception is replaced with a SyntaxError to get a more accurate error report.
$ cat yield-gen.py
def f():
return ((yield x) for x in range(3))
$ ./python -Wd yield-gen.py
yield-gen.py:2: DeprecationWarning: 'yield' inside generator expression
return ((yield x) for x in range(3))
$ ./python -We yield-gen.py
File "yield-gen.py", line 2
return ((yield x) for x in range(3))
^
SyntaxError: 'yield' inside generator expression
Without this replacement the result would be:
$ ./python -We yield-gen.py
DeprecationWarning: 'yield' inside generator expression
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue10544>
_______________________________________
More information about the Python-bugs-list
mailing list