A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-April/064221.html below:

[Python-Dev] With context, please

[Python-Dev] With context, pleasePaul Moore p.f.moore at gmail.com
Sun Apr 23 15:31:30 CEST 2006
On 4/23/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
>   - contextlib.contextmanager()
>       - is actually used to define contexts according to the current docs
>       - but returns a GeneratorContextManager object

You may just be trying to avoid overcomplicating things by adding too
much detail here, but you have missed my point about contextmanager -
it's used in two, distinct, ways:

1. On a simple function, to define a context manager (that's fine, and
in line with the docs)
2. On a __context__ method to define a "function that returns a context"

The sticking point is (2), which is *neither a context, nor a context
manager*. Purely by coincidence, a context manager will do here, but
it's more than is needed.

So I still believe that you need 2 separate decorators here (no matter
how much implementation they share).

I've not looked at your other examples, as I'm deliberately trying
*not* to understand the details any further until I've read your
proposed docs...

Paul.
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