I have a generator function, i've filled in the function if there are no more_seqs. But I feel trouble if there are more sequences. I need to generate 1 tuple at a time. if the function call is
generate_zip(range(5),range(3),range(4),range(5)) then the tuple generated should be (0,0,0,0) (1,1,1,1) n so on
def generator_zip(seq1, seq2, *more_seqs): t1 = [(x,y) for i,x in enumerate(seq1) for j,y in enumerate(seq2) if i == j] if len(more_seqs) == 0: for tup in t1: yield tup
can anyone suggest me a way to unpack more_seqs and then join the tuples of seq1,seq2 with more_seqs tuples and then yield??