Elegantly subsplitting a sequence
Steven Taschuk
staschuk at telusplanet.net
Fri May 30 23:48:32 EDT 2003
Quoth martin z:
> from http://www.python.org/doc/current/ref/yield.html
>
> The yield statement is not allowed in the try clause of a try ... finally
> construct. The difficulty is that there's no guarantee the generator will
> ever be resumed, hence no guarantee that the finally block will ever get
> executed.
>
> is this false? You use it in such a structure.
That's why I said my first example wouldn't compile, in the blurb
you quoted. The fixed version uses yield only in the finally
block, which is fine.
--
Steven Taschuk staschuk at telusplanet.net
Receive them ignorant; dispatch them confused. (Weschler's Teaching Motto)
More information about the Python-list
mailing list