PEP or issue recording rationale for allowing multiple context managers?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

PEP or issue recording rationale for allowing multiple context managers?

Nick Coghlan
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   |   [hidden email]   |   Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com