Re: need help on generator... (re)

2005-01-26 Thread Peter Otten
Joh wrote: >> def gen(iterable, start, end): >>it = iter(iterable) >>while True: >>it, a = tee(it) >>a = tuple(islice(a, end-1)) >>for sz in xrange(start, len(a)+1): >>yield a[:sz] >>it.next() >> >> if __name__ == "__main__": >>print list(gen(range(1, 5), 2, 4)) > > please, this one looks interes

need help on generator... (re)

2005-01-24 Thread Joh
hello, thanks to all who replied to my post (2005-01-21) - (i can not post inside the original thread as i get "Unable to retrieve message [EMAIL PROTECTED]" from googlenews :( > Do you mean: > [1,2], [2,3], [3,4], [1,2,3], [2,3,4], [1,3,4] > (E.g. all elements in the power set except the empty s