def output(seq, linelength = 60):
if seq:
iterseq = iter(seq)
while iterseq:
print "".join(islice(iterseq,linelength))
Worth noting: "while iterseq" only works because for this case, you have a list iterator, which provides a __len__ method. This approach will not work when you have an iterator that does not provide a __len__ method. For a nice infinite printing loop, try:
def gen():
yield '+'*100
yield '*'*100output(gen())
STeVe -- http://mail.python.org/mailman/listinfo/python-list
