Created
November 10, 2018 12:30
-
-
Save starrify/0f46fbb385c08314205a6c52b3a37b50 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
Python 3.7.1 (default, Oct 22 2018, 10:41:28) | |
[GCC 8.2.1 20180831] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> def foo(): | |
... yield 1 | |
... return 2 | |
... | |
>>> def bar(gen): | |
... baz = yield from gen | |
... print('hey baz: %s' % baz) | |
... | |
>>> list(bar(foo())) | |
hey baz: 2 | |
[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment