Skip to content

Instantly share code, notes, and snippets.

@evilkost
Created July 8, 2010 16:20
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 evilkost/468246 to your computer and use it in GitHub Desktop.
Save evilkost/468246 to your computer and use it in GitHub Desktop.
def main_g(inp_iter, c):
while True:
count = [0,]
def inner_g():
while count[0] < c:
yield inp_iter.next()
count[0] += 1
else:
count[0] = 0
raise StopIteration()
yield inner_g()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment