A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2009-June/090018.html below:

[Python-Dev] Iterator version of contextlib.nested

[Python-Dev] Iterator version of contextlib.nested [Python-Dev] Iterator version of contextlib.nestedHagen Fürstenau hfuerstenau at gmx.net
Sat Jun 13 14:45:56 CEST 2009
> The semantic change actually needed to make nested() more equivalent to
> the multi-with statement is for it to accept zero-argument callables
> that create context managers as arguments rather than pre-created
> context managers.

It seems to me that both passing callables which return managers and
passing a generator which yields managers achieve about the same thing.
Are you proposing the former just to avoid introducing a new interface?

> Rather than changing the name of the function, this could be done by
> inspecting the first argument for an "__enter__" method. If it has one,
> use the old semantics (and issue a DeprecationWarning as in 3.1).
> Otherwise, use the proposed new semantics.

I guess this is much too late for 3.1, but could we then at least
un-deprecate "contextlib.nested" for now? As it is, you get a
DeprecationWarning for something like

with contextlib.nested(*my_managers):

without any good way to get rid of it.

- Hagen
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4