Behavior of the for-else construct

Dan Stromberg drsalists at gmail.com
Thu Mar 3 09:52:33 EST 2022


On Thu, Mar 3, 2022 at 5:24 AM computermaster360 <
computermaster360 at gmail.com> wrote:

> I want to make a little survey here.
>
> Do you find the for-else construct useful? Have you used it in
> practice? Do you even know how it works, or that there is such a thing
> in Python?
>
> I have used it maybe once. My issue with this construct is that
> calling the second block `else` doesn't make sense; a much more
> sensible name would be `then`.
>

I use it and like it.

You need break's to make it useful - then it cuts down on unnecessary
booleans.


More information about the Python-list mailing list