Rhamphoryncus wrote:
> I've run into this problem a few times, and although many solutions
> have been presented specifically for printing I would like to present a
> more general alternative.
[snip interesting istep function]
> Would anybody else find this useful? Maybe worth adding it to itertool?
yeah, but why on earth did you make it so complicated?
def istep(iterable, step):
a=[]
for x in iterable:
if len(a) >= step:
yield a
a=[]
a.append(x)
if a:
yield a
--
- Justin
--
http://mail.python.org/mailman/listinfo/python-list