[Python-ideas] Control Flow - Never Executed Loop Body
Sven R. Kunze
srkunze at mail.de
Tue Mar 22 08:30:50 EDT 2016
On 20.03.2016 21:16, Andrew Barnert wrote:
> More generally, I think if this feature were to be added, "empty" is a
> reasonable name. The idiomatic way to write it today is something like:
>
> elem = empty = object()
> for elem in seq:
> do_stuff(elem)
> if elem is empty:
> do_empty_seq_stuff()
>
> So you're basically looking for syntactic sugar that abbreviated "if
> ... is empty:", right?
>
Basically. The future discussion showed that the idiomatic way is not
100% correct but I think you got the idea.
Best,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160322/85255e92/attachment.html>
More information about the Python-ideas
mailing list