Skip to content

Instantly share code, notes, and snippets.

@mikeplavsky
Created March 2, 2019 20:28
Show Gist options
  • Save mikeplavsky/3ca793afde9755373421d685ca07be5c to your computer and use it in GitHub Desktop.
Save mikeplavsky/3ca793afde9755373421d685ca07be5c to your computer and use it in GitHub Desktop.
pong_c = None
ping_c = None
def ping():
i = 0
while True:
res = yield
print(res)
i += 1
pong_c.send("ping")
def pong():
i = 0
while True:
res = yield
print(res)
i += 1
ping_c.send("pong")
pong_c = pong()
ping_c = ping()
pong_c.send(None)
ping_c.send(None)
ping_c.send("start")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment