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 instance
- use "continue EXPR" to pass a value to the generator
- generator exception handling explained

This looks pretty cool.

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?

2. I assume it would be a hack to try to use block statements to implement
   something like interfaces or classes, because doing so would require
   significant local-variable manipulation.  I'm guessing that
   either implementing interfaces (or implementing a class statement
   in which the class was created before execution of a suite)
   is not a use case for this PEP.

Jim

--
Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
_______________________________________________
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

Reply via email to