srinivas devaki wrote: Interesting approach.
> def myngrams(iterable, n=2): > t = list(tee(iterable, 1)) I don't think I've seen tee(iterable, 1) before. Did you do this for aesthetic reasons or is there an advantage over t = [iter(iterable)] ? > for _ in range(n - 1): > t.extend(tee(t.pop())) > next(t[-1], None) > return zip(*t) -- https://mail.python.org/mailman/listinfo/python-list