On 12/14/2009 10:21 AM, exar...@twistedmatrix.com wrote:
I'm asking about why the behavior of a StopIteration exception being handled from the `expression` of a generator expression to mean "stop the loop" is accepted by "the devs" as acceptable.
Any unhandled exception within a loop stops the loop, and the exception is passed to the surrounding code.
To continue your comparison to for loops, it's as if a loop like this: for a in b: c actually meant this: for a in b: try: c except StopIteration: break
No it does not. If c raises any exception, the loop stops *and* the exception is passed up to the surrounding code.
Note, I know *why* the implementation leads to this behavior.
You do not seem to know what the behavior is. Read what I wrote last night. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list