[Python-Dev] PEP 344: Implicit Chaining Semantics

Ka-Ping Yee python-dev at zesty.ca
Fri May 20 10:42:32 CEST 2005


On Fri, 20 May 2005, Ka-Ping Yee wrote:
> Can be back up and see if we can agree on a specification at a semantic
> level first?  I've been trying to narrow down exactly what you seem to
> intuitively want -- how do you like the following:
>
>    Definition of "context": An exception-raise event X is the context
>    for an exception-raise event Y if and only if
>
>    1.  Y occurs after X in the same thread.
>
>    2.  If an 'except' clause catches X, Y occurs before exit from this
>        clause and is not caught before exit from this clause.

Dang.  I forgot to deal with what 'exit' means in the face of 'yield'.

   2.  If an 'except' clause catches X, Y occurs before "exit" from or
       while "inside" this clause, and is not caught before "exit" from
       or while "inside" this clause.

       "Enter" means entering at the beginning or resuming after yield.
       "Exit" means execution of return or yield, jumping out of a block
       via break or continue, or reaching the end of the block.

       "Inside" means entered and not yet exited.


-- ?!ng


More information about the Python-Dev mailing list