Scheme style and Python style [was: Re: Typed Python?]
François Pinard
pinard at iro.umontreal.ca
Tue Jul 13 15:06:16 EDT 2004
[Christopher T King]
> [François Pinard]
> > Suddenly backtracking out of a complex involvement for restarting
> > in a new direction, for the above project at least, requires a lot
> > of state resumption, and doing this cleanly in Python implies a
> > rather strict and burdening discipline about where and how the state
> > information is kept. While tractable, this is not as comfortable as
> > I would have liked it...
> 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?
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.
> Dunno if this helps or not....
Thinking always help! Thanks for sharing your thoughts.
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list