On 7/25/2020 3:11 PM, Christopher Barker wrote:

On Sat, Jul 25, 2020 at 4:39 AM Eric V. Smith <e...@trueblade.com <mailto:e...@trueblade.com>> wrote:

    But all of these always make me wonder about a return inside the
    suite.
    Does the "else" part execute (answer: no). So as a rule, I avoid the
    construct entirely,


really? does an if-else clause execute if there's a return in the if? no. why would this be any more confusing?

Because I always remember "for ... else" has something to do with leaving the loop early, but I don't recall if it's more like try ... finally, or if it's related to the loop exiting early, or the loop not exiting early, or something else I can't recall.

So, the answer to your "really?" question is "yes".

Eric


_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/NSFBD2VC5VTRQ6FWMNT3C3OKDH7HTYGP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to