
On Mar 16, 2009, at 3:40 PM, Nick Coghlan wrote:
Not wasted - I prefer having this as a recognised limitation of the semantics rather than as an accident of the implementation.
Well, I'm glad some good came from the issue report. =)
Who knows, maybe somebody will come up with a real world use case some day and we can drag the PEP out and dust it off a bit :)
I don't expect this to be at all compelling, but FWIW: 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() Of course it was all possible if I used the component CMs directly: with parent_trap(): with fork_but_raise_in_parent(): run_some_subprocess() And thus: def daemonized(): return contextlib.nested(parent_trap(), fork_but_raise_in_parent())