]> granicus.if.org Git - python/commit
bpo-10544: Deprecate "yield" in comprehensions and generator expressions. (GH-4579)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 1 Dec 2017 04:54:17 +0000 (06:54 +0200)
committerNick Coghlan <ncoghlan@gmail.com>
Fri, 1 Dec 2017 04:54:17 +0000 (14:54 +1000)
commit73a7e9b10b2ec9636e3c6396cf7b3695f8ed1856
tree14101bd8c629aad1d3ae7cf77e1946516ddeba80
parent6a89481680b921e7b317c29877bdda9a6031e5ad
bpo-10544: Deprecate "yield" in comprehensions and generator expressions. (GH-4579)

The current behaviour of yield expressions inside comprehensions  and
generator expressions is essentially an accident of implementation - it
arises implicitly from the way the compiler handles yield expressions inside
nested functions and generators.

Since the current behaviour wasn't deliberately designed, and is inherently
confusing, we're deprecating it, with no current plans to reintroduce it.
Instead, our advice will be to use a named nested generator definition
for cases where this behaviour is desired.
Doc/reference/expressions.rst
Doc/whatsnew/3.7.rst
Lib/test/test_generators.py
Lib/test/test_grammar.py
Misc/NEWS.d/next/Core and Builtins/2017-11-27-08-37-34.bpo-10544.07nioT.rst [new file with mode: 0644]
Python/symtable.c