Jim Fulton wrote:
Duncan Booth wrote:
Jim Fulton <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
Guido van Rossum wrote:
I've written a PEP about this topic. It's PEP 340: Anonymous Block Statements (http://python.org/peps/pep-0340.html).
Some observations:
1. It looks to me like a bare return or a return with an EXPR3 that
happens to evaluate to None inside a block simply exits the block, rather
than exiting a surrounding function. Did I miss something, or is
this a bug?
No, the return sets a flag and raises StopIteration which should make the iterator also raise StopIteration at which point the real return happens.
Only if exc is not None
The only return in the pseudocode is inside "if exc is not None". Is there another return that's not shown? ;)
I agree that we leave the block, but it doesn't look like we leave the surrounding scope.
that we are having this discussion at all seems a signal that the semantics are likely too subtle.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com