PEP 315: Enhanced While Loop
Dirk Gerrits
dirk at gerrits.homeip.net
Sat May 3 04:09:53 EDT 2003
Ben Allfree wrote:
> Can you provide an example snippit?
I was just doing this yesterday:
print "Type 'exit' to quit..."
line = raw_input("> ")
while line != "exit":
process_line(line)
line = raw_input("> ")
With the new PEP it would look like this, I think:
print "Type 'exit' to quit..."
do:
line = raw_input("> ")
while line != "exit":
process_line(line)
Of course, I only had one line of setup code so the PEP didn't actually
shorten it a lot, but I can imagine what this would do to bigger examples.
I rather like it.
Dirk Gerrits
More information about the Python-list
mailing list