Advertisement
Guest User

comb-yield

a guest
Feb 2nd, 2015
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1. def comb(l1, l2, l3):
  2.     for e1 in l1:
  3.         for e2 in l2:
  4.             for e3 in l3:
  5.                 yield (e1, e2, e3)
  6.     raise StopIteration()
  7.  
  8. for c in comb([0,1,2], [0,1], [0,1]):
  9.     print c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement