If/then style question

Tim Golden mail at timgolden.me.uk
Fri Dec 17 11:13:38 EST 2010


On 17/12/2010 15:53, Steve Holden wrote:

[... snip example of for-else ...]

> This construct appears to be unpopular in actual use, and when it comes
> up in classes and seminars there is always interesting debate as people
> discuss potential uses and realise there are useful applications.

I use this not infrequently, and I like it when it seems to be an
elegant way to express the code path. But I still misremember from
time to time and assume that the "else" clause fires when the for
loop is empty.

TJG



More information about the Python-list mailing list