[Python-Dev] Iterator version of contextlib.nested
Benjamin Peterson
benjamin at python.org
Mon Jun 15 04:58:30 CEST 2009
2009/6/14 Raymond Hettinger <python at rcn.com>:
> FWIW, I think resurrecting contextlib.nested() is a bad idea.
> Part of the justification for the new with-statement syntax was
> that nested() doesn't have a way to finalize the constructors
> if one of them fails. It is a pitfall for the unwary. And now
> that we have the new with-statement syntax, it mostly just
> represents a second-way-to-do-it (a second way that has
> has the stated pitfall).
I don't consider changing a DeprecationWarning to a
PendingDeprecationWarning "resurrecting" its target. Fully deprecating
a feature in the same version that we add its replacement will just
make more difficulties for cross-version libraries.
....
> I suggest a PEP for 2.7 and 3.2 for building-out the
> with-statement to support tuples of context managers
> (perhaps modeled after the syntax for except-statements
> which allows either individual exceptions or tuples of
> exceptions).
I think the question of extending the syntax later is orthogonal to
the issue of the DeprecationWarning.
--
Regards,
Benjamin
More information about the Python-Dev
mailing list