Alex Martelli wrote: > James Stroud <[EMAIL PROTECTED]> wrote: > ... > >>def doit(rows, doers, i=0): >> for r, alist in groupby(rows, itemgetter(i)): >> if len(doers) > 1: >> doit(alist, doers[1:], i+1) >> doers[0](r) > > > Isn't this making N useless slices (thus copies, for most kinds of > sequences) for a doers of length N? Since you're passing i anyway, it > seems to me that: > > def doit(rows, doers, i=0): > for r, alist in groupby(rows, itemgetter(i)): > if len(doers) > i+1: > doit(alist, doers, i+1) > doers[i](r) > > is equivalent to your code, but avoids these slices (thus copies). > > > Alex
Yes, it does seem the copies are useless. Thank you. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list