On Jul 16, 3:56 pm, marduk <[EMAIL PROTECTED]> wrote: > On Mon, 2007-07-16 at 16:31 -0500, marduk wrote: > > Assuming you meant '0xF0' instead of '0x80'.... do you mean any value > > >=240 starts a new group? If so: No, I meant 0x80. 0x80 is only the most significant bit of the 0xF0 value. Every time this bit is set indicates the start of a new group. Anyway, I like this algorithm better than mine, less code. I've modified yours to make the fn a parameter:
def splitIntoGroups(data, fn): groups = [] current = [] for i in data: if fn(i): current = [] groups.append(current) current.append(i) return groups print splitIntoGroups(l, lambda x : x & 0x80) -- http://mail.python.org/mailman/listinfo/python-list