Skip to content

Instantly share code, notes, and snippets.

@dutc
Created May 13, 2014 19:38
Show Gist options
  • Save dutc/aa122c9976d5fd8890da to your computer and use it in GitHub Desktop.
Save dutc/aa122c9976d5fd8890da to your computer and use it in GitHub Desktop.
itertools question
from itertools import cycle, chain
xs = [1,2,3]
ys = [4,5,6]
for x,y in chain(zip(cycle([2]), xs), zip(cycle([9]), ys)):
print(x+y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment