-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I'm trying to use this continuation library but I cannot figure out how to call a saved continuation.
Please consider the below example which should implement an infinite while cycle.
How would I go to implement the restorecc function?
Thank you in advance.
from continuation import with_CC, with_continuation
saved = None
@with_continuation
def savecc(k):
def _inner():
print("Saving CC")
global saved
saved = k
return _inner
@with_continuation
def nothing(k):
def _inner():
pass
return _inner
def restorecc():
print("Restoring CC")
global saved
(saved << nothing)()
def cycle():
print("We are at the start")
i = 0
(with_CC >> savecc)()
i = i + 1
print(f"I: {i}")
restorecc()
cycle()Metadata
Metadata
Assignees
Labels
No labels