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

Chris Barker chris.barker at noaa.gov
Thu Mar 24 17:33:15 EDT 2016


>From the perspective of many, many (most?) people.  I use for loops and
> while loops *alot*, and I can count the times I have wanted to use the
> `else` clause in the meaning of "all my tests failed, so do this block" on
> the fingers of one hand.


I"ve only used for .. else a handful of times, and honestly, probably
forgot to use it when it would have been the right way to do something far
more times :-)

but I can't think of a SINGLE time when I wanted to know that the loop
didn't run because it's iterable was empty.

Which is my way of saying: I think adding something would make this use
case more clear and easy to do, but it's a rare enough use case that it's
not worth it.

-CHB

-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160324/769e9c6c/attachment.html>


More information about the Python-ideas mailing list