why no break N levels, as in other leading languages?

Carl Banks imbosol at aerojockey.com
Mon May 5 21:55:23 EDT 2003


Dan Jacobson <jidanni at dman.ddts.net> wrote in message news:<87ptn2xx5o.fsf at jidanni.org>...
> ... oops, where were we? Anyway, in python did he forget
> about giving it a N ability or is there of course some higher
> principle involved?
> 
> Nothing mentioned about when one wants to use N in either "help" or
> tut/node6.html


It seems that there are two reasons to break out of a double loop:

1. You're performing a search, and want to terminate the search when
you find what you're looking for.

2. You encounter an error or interruption when looping and want to
abort

The standard answer to these is:

1. If you're doing linear searches in two dimensions, you should be
doing it differently.

2. Since it's an error or interruption, an exeption is appropriate.

However, I can imagine some cases where it is appropriate to search at
more than one dimension (maybe, it's a subsearch of mostly
one-dimensional data).  That's life; we can't have a special syntax
for every little useful and appropriate thing we want to do.  It's ok
to just work around it with an exception.


-- 
CARL BANKS




More information about the Python-list mailing list