Re: Conditionally skipping the contents of a with-statement

2009-08-21 Thread Diez B. Roggisch
tsuraan schrieb: I'd like to write a Fork class to wrap os.fork that allows something like this: with Fork(): # to child stuff, end of block will automatically os._exit() # parent stuff goes here This would require (I think) that the __enter__ method of my Fork class to be able to return a va

Conditionally skipping the contents of a with-statement

2009-08-21 Thread tsuraan
I'd like to write a Fork class to wrap os.fork that allows something like this: with Fork(): # to child stuff, end of block will automatically os._exit() # parent stuff goes here This would require (I think) that the __enter__ method of my Fork class to be able to return a value or raise an exc