Re: `yield` in a `try/finally` block, pre-Python 2.5

2007-06-04 Thread Adam Atlas
On Jun 4, 1:49 am, yuce <[EMAIL PROTECTED]> wrote: > I had the same problem, you can > see:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/130004 > for a solution. > > Happy hacking, > > Yuce Thanks. I thought of doing something like that, but in my program, it's important that the order

Re: `yield` in a `try/finally` block, pre-Python 2.5

2007-06-03 Thread yuce
I had the same problem, you can see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/130004 for a solution. Happy hacking, Yuce On Jun 4, 8:23 am, Adam Atlas <[EMAIL PROTECTED]> wrote: > I'm trying to emulate the Python 2.5 behaviour (PEP 342) of generator > functions where the `yield`

`yield` in a `try/finally` block, pre-Python 2.5

2007-06-03 Thread Adam Atlas
I'm trying to emulate the Python 2.5 behaviour (PEP 342) of generator functions where the `yield` statement is in a `try/finally` block. Basically, where the `finally` block is guaranteed to run even if the generator doesn't finish running: it simply runs when the generator is garbage-collected. Do