Last active
May 5, 2019 21:49
-
-
Save att288/1289b517d3b920ea96bd5dfdbe0a3192 to your computer and use it in GitHub Desktop.
connect_generators.py
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 my_gen_1(n): | |
for i in range(n): | |
yield f'g1: {i}' | |
def my_gen_2(n): | |
for j in range(n): | |
yield f'g2: {-j}' | |
def my_gen_master(n): | |
yield from my_gen_1(n) | |
yield from my_gen_2(n) | |
if __name__ == '__main__': | |
for result in my_gen_master(5): | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment