Skip to content

Instantly share code, notes, and snippets.

@smoitra87
Created November 16, 2013 19:49
Show Gist options
  • Save smoitra87/7504482 to your computer and use it in GitHub Desktop.
Save smoitra87/7504482 to your computer and use it in GitHub Desktop.
Using a generator expression to modify a for loop
for x in (x for x in arr if x>0):
print('{} is positive'.format(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment