[Python-Dev] Merging PEP 310 and PEP 340-redux?

Guido van Rossum gvanrossum at gmail.com
Fri May 13 20:38:51 CEST 2005


[Nick Coghlan]
> However, I'm fine with declaring that, from the perspective of a statement
> template, 'return', 'break' and 'continue' are all 'non-exceptional exits', and
> so templates like transaction() are expected to treat them as such.

Me too. The argument that made me realize this is okay came after
reading Raymond Chen's rant about control-flow macros: when you catch
an exception, you don't know how much of the try-block was executed
successfully, and neither does the author of that block; but when you
"catch" a non-local goto, you must assume that the block's author
knows what they are doing, so at least *they* know exactly which code
was executed (everything up to the break/continue/return) and which
wasn't. So the argument about rolling back indeterminate results
doesn't hold. If they want the transaction to fail, they should raise
an exception.

I really need to start writing PEP 343 to capture this particular
solution more carefully.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list