A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-November/150762.html below:

[Python-Dev] Tricky way of of creating a generator via a comprehension expression

[Python-Dev] Tricky way of of creating a generator via a comprehension expression [Python-Dev] Tricky way of of creating a generator via a comprehension expressionIvan Levkivskyi levkivskyi at gmail.com
Thu Nov 23 06:39:46 EST 2017
On 23 November 2017 at 12:38, Ivan Levkivskyi <levkivskyi at gmail.com> wrote:

> On 23 November 2017 at 11:55, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
>> On 23 November 2017 at 18:11, Greg Ewing <greg.ewing at canterbury.ac.nz>
>> wrote:
>>
>>> Ivan Levkivskyi wrote:
>>>
>>>> "People sometimes want to refactor for-loops containing `yield` into a
>>>> comprehension but that doesn't work (particularly because of the hidden
>>>> function scope) - lets make it a SyntaxError"
>>>>
>>>
>>> Personally I'd be fine with removing the implicit function
>>> scope from comprehensions and allowing yield in them, since
>>> the semantics of that are clear.
>>>
>>
>> People keep saying this, but seriously, those semantics aren't clear at
>> all once you actually start trying to implement it.
>>
>>
> If Serhiy will implement his idea (emitting for-loop bytecode inside a
> try-finally), then I see no problems accepting it as a fix.
>

Also I think it makes sense to keep discussion in one place, i.e. either
here xor at https://bugs.python.org/issue10544

--
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171123/a17c0ba8/attachment.html>
More information about the Python-Dev mailing list

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