[ python-Feature Requests-846553 ] Addition to break and continue

SourceForge.net noreply at sourceforge.net
Fri Nov 21 07:48:12 EST 2003


Feature Requests item #846553, was opened at 2003-11-21 12:48
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=846553&group_id=5470

Category: Parser/Compiler
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Alexander Rødseth (alexanro)
Assigned to: Nobody/Anonymous (nobody)
Summary: Addition to break and continue

Initial Comment:
It would be great if one could use "break for", "break
while", "continue for" or "continue while".

A silly example:

for i in range(100):
    counter = 0
    while 1+1 == 2:
        counter += 1
        if counter > 5:
            break for

"break for" should here jump out of the for-loop, as
opposed to just "break" that would jump out of just the
while loop. Using "break for" and friends will make
code a lot more readable and explicit, and avoid using
exception throwing and catching, and other acrobatics.

I believe this suggestion is in sync with the Python
Design guidelines.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=846553&group_id=5470



More information about the Python-bugs-list mailing list