Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created January 27, 2020 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/565932dc0863dab9b2e286bc8d6ccdb2 to your computer and use it in GitHub Desktop.
Save kunigami/565932dc0863dab9b2e286bc8d6ccdb2 to your computer and use it in GitHub Desktop.
def echo():
x = yield 'ready'
print(x)
f = echo()
f.send(None) # Moves to the yield line, gets 'ready'
f.send('hi') # Sends hi but throws StopIteration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment