Skip to content

Instantly share code, notes, and snippets.

@alairock
Created July 30, 2018 22:57
Show Gist options
  • Save alairock/822ede91eb7e8d8a7d76cefee72a6bc2 to your computer and use it in GitHub Desktop.
Save alairock/822ede91eb7e8d8a7d76cefee72a6bc2 to your computer and use it in GitHub Desktop.
Generator pipelining hard
def employees():
for y in ['Bob', 'Sally', 'Jake']:
yield y
def customers():
for ex in ['James', 'Ted', 'Kent']:
yield ex
def retrieve_all_users():
for employee in employees():
yield employee
for customer in customers():
yield customer
for user in retrieve_all_users():
print(user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment