Behavior of the for-else construct

Peter J. Holzer hjp-python at hjp.at
Sat Mar 5 06:51:00 EST 2022


On 2022-03-05 00:25:44 +0100, Peter J. Holzer wrote:
> On 2022-03-04 11:34:07 +1100, Chris Angelico wrote:
> > What I'm hearing is that there are, broadly speaking, two types of
> > programmers [1]:
> > 
> > 1) Those who think about "for-else" as a search tool and perfectly
> > understand how it behaves
> > 2) Those who have an incorrect idea about what for-else is supposed to
> > do, don't understand it, and don't like it.
> 
> 3) Those who understand what it does und don't even find it*s syntax
> very confusing, yet only very rarely find it useful.
> 
> I have probably used it a handful of times in 8 years of Python
> programming. Coincidentally, I think I used it just this week - but I
> can't find it any more which probably means that it was either in a
> throwaway script or I have since rewritten the code.

Just found it again. Not yet committed, and I may still end up rewriting
it again before turning in the pull request, but for now it's the
simplest solution for the problem.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20220305/7cfc13c4/attachment.sig>


More information about the Python-list mailing list