[Python-Dev] with-statement heads-up (original) (raw)
Guido van Rossum guido at python.org
Tue Feb 28 23:01:49 CET 2006
- Previous message: [Python-Dev] with-statement heads-up
- Next message: [Python-Dev] with-statement heads-up
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2/28/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
Guido van Rossum wrote: > I just realized that there's a bug in the with-statement as currently > checked in. exit is supposed to re-raise the exception if there > was one; if it returns normally, the finally clause is NOT to re-raise > it. The fix is relatively simple (I believe) but requires updating > lots of unit tests. It'll be a while.
So does that mean with statements will be able to suppress exceptions now? (If I'm reading the PEP changes right it does, but I haven't finished my coffee yet. . .)
Yes. And unless there are peasants at the gate with pitchforks etc. it will stay that way. :-)
I'm not complaining if that's so, as I think allowing it makes the operation of the statement both more useful and more intuitive, but you were originally concerned about the potential for hidden flow control if the context manager could suppress exceptions, as well as the need to remember to write "raise" in the except clauses of context managers.
Yes, I've changed my mind about that.
If you changed your mind along the way, that should probably be explained in the PEP somewhere :)
I don't know that PEPs benefit from too much "on the one hand, on the other hand, on the third hand" or "and then I changed my mind, and then I changed it back, and then I changed it again".
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] with-statement heads-up
- Next message: [Python-Dev] with-statement heads-up
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]