James Stroud wrote: > Here's how I *would* do it: > > py> def doit(alist): > ... ary = [] > ... for i in alist: > ... if 0xf0 & i: > ... ary.append([i]) > ... else: > ... ary[-1].append(i) > ... return [x for x in ary if x] > ...
To be absolutely compliant with the specifications, it should be return [x for x in ary if len(x)>1] in the recommended way. This does not affect the example given, though. 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