Skip to content

Instantly share code, notes, and snippets.

@raphaelfruneaux
Created November 26, 2019 21:54
Show Gist options
  • Save raphaelfruneaux/d287489bb886513b165899fbae2a84f6 to your computer and use it in GitHub Desktop.
Save raphaelfruneaux/d287489bb886513b165899fbae2a84f6 to your computer and use it in GitHub Desktop.
# how to create a generator
def numbers():
for n in range(100):
yield n
# how to create a generator expression
numbers = (n for n in range(100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment