[Python-Dev] Re: [Python-iterators] Python generators and try/finally..

David Jeske jeske@chat.net
Mon, 14 Jan 2002 15:22:00 -0800


On Mon, Jan 14, 2002 at 07:18:40PM -0500, Tim Peters wrote:
> It's not that severe, Neil: the only restriction is that yield
> cannot appear in the try clause of a try/finally construct.
> try/finally can otherwise be used freely inside generators, and
> yield can be used anywhere inside a generator inside
> try/except/else, and even in a finally clause (these latter assuming
> the yield is not also in the try clause of an *enclosing*
> try/finally construct) -- just not in a try/finally's try clause.

Thanks for your thoughts, I'll defer this discussion until I do run
across a programming problem or two where the lack of finally cleanup
hurts the Generator, and then I'll bring that example to the table.

Thanks again for spending the time on Generators, it looks like a
truly neat and orthogonal feature.

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net