[Python-Dev] Re: anonymous blocks

Phillip J. Eby pje at telecommunity.com
Wed Apr 27 17:01:27 CEST 2005

At 12:30 AM 4/27/05 -0700, 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 highlights:
>- temporarily sidestepping the syntax by proposing 'block' instead of 'with'
>- __next__() argument simplified to StopIteration or ContinueIteration 
>- use "continue EXPR" to pass a value to the generator
>- generator exception handling explained

Very nice.  It's not clear from the text, btw, if normal exceptions can be 
passed into __next__, and if so, whether they can include a traceback.  If 
they *can*, then generators can also be considered co-routines now, in 
which case it might make sense to call blocks "coroutine blocks", because 
they're basically a way to interleave a block of code with the execution of 
a specified coroutine.

More information about the Python-Dev mailing list