From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3D344A12.5000503@strakt.com> From: Boyd Roberts User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1 MIME-Version: 1.0 To: 9fans@cse.psu.edu Subject: Re: [9fans] useful language extension, or no? References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 16 Jul 2002 18:30:10 +0200 Topicbox-Message-UUID: cdbe24ea-eaca-11e9-9e20-41e7f4b1d025 Sam wrote: >just equates to > >for(...) { > >} atend > ; > python lets you do this: for v in ...: if v == ...: break else: atend So the else part is executed should the loop terminate normally (no break is executed or the loop body is never entered). It can be applied to while loops too. I'm not sure whether it's a great idea but it did save a 'match' variable when I was trying to match one 'condition' in a list of 'conditions'.