Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 23 lines (16 sloc) 360 Bytes
from greenlet import greenlet
def sub():
print("sub is switching to two.")
g2.switch()
print("sub is done.")
def one():
sub()
def two():
print("two is switching to one.")
g1.switch()
print("two is done.")
g1 = greenlet(one)
g2 = greenlet(two)
print("main switching to one.")
g1.switch()
print("main is done.")