Paul, In your case optimized version, in the second try clause using itertools, it should be like this, shouldn't it?
return t(g.next()[1] for k,g in groupby(s, lambda (i,v): v)) ^^^ Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list