On 23.11.2017 08:38, Ivan Levkivskyi wrote: > I think this code should be just equivalent to this code > > def g(): > temp = [(yield i) for i in range(10)] > return (v for v in temp) > > Semantics of the comprehension should be clear here (just an > equivalent for-loop without name leaking) Excuse me if I disagree here. If I were to understand this in real-world code, I cannot imagine what will happen here. A "yield" within a comprehension is like a "return" in a comprehension. It makes no sense at all. Also a "yield" and a "return with value" is also rarely seen. Comprehensions build new objects, they are not for control flow, IMO. Cheers, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20171123/844f3700/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4