Showing content from http://mail.python.org/pipermail/python-dev/attachments/20171123/844f3700/attachment.html below:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 23.11.2017 08:38, Ivan Levkivskyi wrote:<br>
<blockquote type="cite"
cite="mid:CAOMjWkkkhWMcdWxwUpEVfzLtNPn7kbTPJUa-0_KNyQUuCm99wg@mail.gmail.com">
<meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">I think this code should be just
equivalent to this code
<div><br>
</div>
<div>Â Â Â def g():</div>
<div>Â Â Â Â Â Â Â temp = [(yield i) for i in range(10)]</div>
<div>Â Â Â Â Â Â Â return (v for v in temp)</div>
<div><br>
</div>
<div>Semantics of the comprehension should be clear here
(just an equivalent for-loop without name leaking)</div>
</div>
</div>
</div>
</blockquote>
<br>
Excuse me if I disagree here. If I were to understand this in
real-world code, I cannot imagine what will happen here.<br>
<br>
A "yield" within a comprehension is like a "return" in a
comprehension. It makes no sense at all.<br>
Also a "yield" and a "return with value" is also rarely seen.<br>
<br>
Comprehensions build new objects, they are not for control flow,
IMO.<br>
<br>
Cheers,<br>
Sven<br>
</body>
</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