[Python-Dev] PEP or issue recording rationale for allowing multiple context managers?
Nick Coghlan
ncoghlan at gmail.com
Sun May 2 18:55:59 CEST 2010
I was looking for a reference for the addition of multiple context
manager support to with statements in 3.1 and 2.7 and came up empty
(aside from the initial python-ideas thread [1] that I linked to from
PEP 377).
I was hoping to find something that clearly spelled out:
- the two major flaws in contextlib.nested*
- the parallel with import statements for the precise chosen syntax
- Guido's blessing to go ahead and do it
*Those flaws being
- that __init__/__new__ methods of inner context managers aren't covered
by outer context managers
- that outer context managers can't suppress exceptions from inner
__enter__ methods
Note that I'm not complaining about the decision itself (that would be
silly, since I agree with the outcome), I'm just trying to find
something to point to about it that is a little more concrete than a
python-ideas thread.
Cheers,
Nick.
[1]
http://mail.python.org/pipermail/python-ideas/2009-March/003188.html
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
More information about the Python-Dev
mailing list