[Python-ideas] Control Flow - Never Executed Loop Body

Chris Angelico rosuav at gmail.com
Tue Mar 22 08:29:42 EDT 2016


On Tue, Mar 22, 2016 at 11:27 PM, Sven R. Kunze <srkunze at mail.de> wrote:
>> But now we're getting into the realm of ugly code to deal with edge
>> cases. Like with "yield from", language support can be justified when
>> there's a simple and obvious *but imperfect* way to do something
>> ("yield from x" is not the same as "for item in x: yield item").
>
>
> Exactly. Despite the fact that "yield from" is shorter it can handle edge
> cases more beautiful.

It's not enough shorter than the simple 'for' loop to justify the
dedicated syntax. But check out its *actual* equivalent code and
you'll see that while we're getting toward similar territory, the
for-ifempty loop isn't quite here yet :)

https://www.python.org/dev/peps/pep-0380/#formal-semantics

ChrisA


More information about the Python-ideas mailing list