Author ncoghlan
Recipients eric.snow, kristjan.jonsson, ncoghlan, r.david.murray
Date 2013-08-08.15:33:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
Allowing a context manager to skip the statement body isn't a new proposal,
and I previously argued your side. However, with multiple context managers,
there is no invisible flow control. Two context managers are locally
visible, which means the outer one completely encloses the inner one and
can suppress exceptions it throws. Guido explicitly made the decision to
require two managers at the point of use to achieve that behaviour when I
proposed making the change - he doesn't care about allowing a single
context manager to provide that functionality.

For the other question, how does your version of nested keep people from
doing "nested(open(fname) for name in names)"? That was the core problem
with that style of API: it made it far too easy to introduce a latent
defect when combined with file like objects that eagerly acquire their
resource. It wasn't that it couldn't be used correctly, but that the
natural and obvious way of combining it with open() is silently wrong.
Date User Action Args
2013-08-08 15:33:28ncoghlansetrecipients: + ncoghlan, kristjan.jonsson, r.david.murray, eric.snow
2013-08-08 15:33:28ncoghlanlinkissue18677 messages
2013-08-08 15:33:27ncoghlancreate