Python-based monads essay part 2

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu Oct 20 06:34:48 EDT 2016


Marko Rauhamaa wrote:

>     def main():
>         try:
>             guard_it()
>         except ValueError:
>             # I'm having none of it!
>             resume "CarryOn!"
> 
> The problem is, how can the file f unclose itself when work resumes?

The same thing could happen in Scheme, though. Re-entering a
context via a continuation doesn't magically reset everything
to the way it was at some earlier time. A data structure that
has been mutated will still be mutated, and a file that has
been closed will still be closed.

-- 
Greg



More information about the Python-list mailing list