Skip to content

Instantly share code, notes, and snippets.

@att288
Last active May 5, 2019 21:49
Show Gist options
  • Save att288/1289b517d3b920ea96bd5dfdbe0a3192 to your computer and use it in GitHub Desktop.
Save att288/1289b517d3b920ea96bd5dfdbe0a3192 to your computer and use it in GitHub Desktop.
connect_generators.py
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