Created
January 27, 2020 07:16
-
-
Save kunigami/565932dc0863dab9b2e286bc8d6ccdb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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