[Python-Dev] Daemon process context as a ‘with’ context manager (was: PEP 377 - allow __enter__() methods to skip the statement body)

Ben Finney ben+python at benfinney.id.au
Tue Mar 17 05:16:19 CET 2009


James Pye <lists at jwp.name> writes:

> The identification of this issue came from an *experiment* attempting
> to create a *single* "daemonized()" CM that would execute the with- 
> statement's block in a new child process and, of course, not execute
> it in the parent. At first, I ran into the RuntimeError in the parent
> process, and then after rewriting the CMs as classes, I realized the
> futility.
> 
> with daemonized():
>  run_some_subprocess()

This use case is addressed by my up-coming PEP, currently in draft
form but submitted to the PEP editor. A reference implementation is at
<URL:http://pypi.python.org/pypi/python-daemon/>.

I'd like to know whether this meets your needs; follow-ups privately
to me or in ‘python-ideas’ as you think appropriate.

-- 
 \                             “Holy tintinnabulation, Batman!” —Robin |
  `\                                                                   |
_o__)                                                                  |
Ben Finney



More information about the Python-Dev mailing list