Scheme style and Python style [was: Re: Typed Python?]
Christopher T King
squirrel at WPI.EDU
Tue Jul 13 16:42:48 EDT 2004
On Tue, 13 Jul 2004, [iso-8859-1] François Pinard wrote:
> [Christopher T King]
>
> > It may be possible to do what you want to do using only generators.
>
> > continuation=dostuff()
> > try:
> > value=continuation.next()
> > except StopIteration:
> > <store continuation away for future use>
> > else:
> > <function completed, carry on>
>
> If the generator gets exhausted, what would be the purpose of saving it?
Oops, I got that backwards. It should read:
continuation=dostuff()
try:
value=continuation.next()
except StopIteration:
<function completed, carry on>
else:
<store continuation away for future use>
> I would presume chained generators might ease control of the flow, at
> least to a certain extent, but would not help so much for complex state
> resumption, especially when state is shared between parts of the program.
And hence the need for continuations ;) Perhaps if there was a way to
resume code that was interrupted by an exception?
More information about the Python-list
mailing list