Skip to content

Instantly share code, notes, and snippets.

@beta
Created December 7, 2017 12:21
Show Gist options
  • Save beta/d21dc6ed4eaa4c49d8cb1b5a5eadb210 to your computer and use it in GitHub Desktop.
Save beta/d21dc6ed4eaa4c49d8cb1b5a5eadb210 to your computer and use it in GitHub Desktop.
List comprehension for generator in Python.
squared_gen = (x**2 for x in range(5))
type(squared_gen) # generator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment