Skip to content

Instantly share code, notes, and snippets.

@harlowja
Created August 25, 2014 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harlowja/e0e4be145994d9f972df to your computer and use it in GitHub Desktop.
Save harlowja/e0e4be145994d9f972df to your computer and use it in GitHub Desktop.
Iter close
import six
def do_stuff():
for i in range(0, 10):
yield i
g = do_stuff()
print g
for i in g:
print i
if i == 4:
g.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment