Author ncoghlan
Recipients barry, eric.snow, gvanrossum, kristjan.jonsson, ncoghlan, r.david.murray
Date 2013-08-14.21:48:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I think you make a good case, but I already tried and failed to convince Guido of this in PEP 377 (see

More importantly, see his quoted concerns in

While you have come up with a much simpler *implementation* for PEP 377, which imposes no additional overhead in the typical case (unlike my implementation, which predated the SETUP_WITH opcode and avoided introducing one, which required wrapping every __enter__ call in a separate try/except block), it still adds a new builtin exception type, and I thing needs a new builtin constant as well.

The latter comes in because I think the bound variable name still needs to be set to something, and rather than abusing any existing constant, I think a new SkipWith constant for both "don't call enter/exit" and "with statement body was skipped" would actually be clearer.

I actually think explaining a custom exception and constant is less of a burden than explaining why factoring out certain constructs with @contextmanager and yield doesn't work properly (that's why I wrote PEP 377 in the first place), but Guido is the one that ultimately needs to be convinced of the gain.
Date User Action Args
2013-08-14 21:48:32ncoghlansetrecipients: + ncoghlan, gvanrossum, barry, kristjan.jonsson, r.david.murray, eric.snow
2013-08-14 21:48:32ncoghlansetmessageid: <>
2013-08-14 21:48:32ncoghlanlinkissue18677 messages
2013-08-14 21:48:32ncoghlancreate