22 Mar
2016
22 Mar
'16
12:29 p.m.
On Tue, Mar 22, 2016 at 11:27 PM, Sven R. Kunze
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