Named code blockes

Miki Tebeka tebeka at lycosmail.com
Sat Apr 14 05:34:01 EDT 2001


Hello All,

Obviously I wasn't clear. :-(

The problem I want to address is that continue and break always refer to the
innermost loop they're in. However, it may be desirable to name the loop and
then continue/break explictly this loop. (A know bug is that sometime a new
loop is added in the middle and then the break statement breaks the new loop
and not the old one).

I'd like to see something like (I'm sure you find a nicer syntax than this,
and a better example :-):

import re

def process_file():
    lines = []
    while1: # name code block
    while (1):
        for line in open('somefile').readlines():
            if (re.match('EOF', line): # end of file marker, don't continue
                break while1 # break outer while loop
            lines.append(line)
    return filter(lambda x: re.match('>', line)


Bye.
----------------------------------------------------------------------------
--
Smile, damn it, smile.

lambda msg:

 'name' : 'Miki Tebeka',
 'email' : 'tebeka at lycosmail.com',
 'homepage' : 'www.tebeka.freeservers.com',
 'quote' : "I don't suffer from insanity, I enjoy every minute of it."
}[msg]






More information about the Python-list mailing list