1.5.2 for: else:

William Tanksley wtanksle at dolphin.openprojects.net
Thu Jul 29 13:10:19 EDT 1999


On Thu, 29 Jul 1999 08:51:15 +1200, Greg Ewing wrote:
>Gordon McMillan wrote:

>> But finding a match in a list, and testing whether you
>> fell off the end without finding one, is (without the else clause) a
>> much messier proposal.

>Not if you go about it the right way. I always
>put such loops in a procedure of their own,
>and use return:

>Not only does this not require a weird else
>clause, it doesn't require break either. I
>almost never use break - and when I do I usually
>regret it later. I wouldn't mind if there weren't
>any break - and without break, there would be no
>need for the weird else.

I have to admit that I do the same -- this is why I've never been tripped
up by the else.

>Greg

-- 
-William "Billy" Tanksley




More information about the Python-list mailing list