En Tue, 09 Mar 2010 18:41:10 -0300, Daniel Klein <bri...@gmail.com> escribió:

Basically I'm wondering if there are any plans to implemented named
loops in Python, so I can tell a break command to break out of a
specific loop in the case of nested loops.

See PEP3136 [1] and its rejection note [2]
I think you may find some more discussion in the python-ideas list.

Currently I'm using boolean
flag variables, but I find that very clumsy. I know this idea of
breaking out of specific loops from javascript; I guess java does it
too. It just seems a very Pythonian idea to me: clear, promotes code
legibility, seems obvious.

Although I've occasionally missed the feature myself, I agree with Guido's arguments against it. You have several alternatives: refactor the loop into an auxiliary function, use a specific exception, add boolean flags, or repeat the test at the outer levels. (I usually choose the first).

[1] http://www.python.org/dev/peps/pep-3136/
[2] http://mail.python.org/pipermail/python-3000/2007-July/008663.html

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to