Context manager, atexit processing, and PEP 3143 DaemonContext.close

Ben Finney ben+python at benfinney.id.au
Tue May 19 04:27:37 EDT 2009


Gunter Henriksen <gunterhenriksen at gmail.com> writes:

> If there is a function which triggers a one-shot switch, I like to
> have a way to find out if it has already been triggered, I prefer to
> have the function tell me if it triggered the switch or not, but I
> would not want that to be by raising an exception.

In this case, though, we're talking about a class intended to implement
the context manager API (in addition to other API).

So, following your argument above, we might expect a generic context
manager object to be able to tell us whether we're currently inside that
context or not. Does such a thing exist?

-- 
 \       “If consumers even know there's a DRM, what it is, and how it |
  `\     works, we've already failed.” —Peter Lee, Disney corporation, |
_o__)                                                             2005 |
Ben Finney



More information about the Python-list mailing list