def xcombine(*seqin):
    """Returns a generator which returns combinations of argument sequences.
    For example, ``xcombine((1,2),(3,4))`` returns a generator; calling the
    `next()` method on the generator will return (sequentially):
    ``[1,3], [1,4], [2,3], [2,4]`` and then a :class:`StopIteration` exception.

    This will not create the whole list of combinations in memory at once.
    """
    def rloop(seqin,comb):
        """recursive looping function"""
        if seqin:                  # any more sequences to process?
            for item in seqin[0]:
                newcomb=comb+[item]  # add next item to current combination
                # call rloop wth remaining seqs, newcomb
                for item in rloop(seqin[1:],newcomb):
                    yield item        # seqs and newcomb
        else:                          # processing last sequence
            yield comb                # comb finished, add to list
    return rloop(seqin,[])