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

SourceForge.net noreply at sourceforge.net
Fri Nov 21 20:43:24 EST 2003


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

Category: Python Interpreter Core
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.

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

Comment By: Michael Dubner (dubnerm)
Date: 2003-11-22 04:43

Message:
Logged In: YES 
user_id=39274

What you will do to exit from outer of two for's from inside
inner?

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

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