On Aug 27, 4:34 pm, [EMAIL PROTECTED] wrote: > George Sakkis: > > > This seems the most efficient so far for arbitrary iterables. > > This one probably scores well with Psyco ;-) > > def start_good3(seq, good_ones=4): > n_good = 0 > pos = 0 > for el in seq: > if el: > if n_good == good_ones: > return pos - good_ones > else: > n_good += 1 > elif n_good: > n_good = 0 > pos += 1 > if n_good == good_ones: > return pos - good_ones > else: > return -1 > > Bye, > bearophile
There, that's the regular machine for it. Too much thinking in objects, and you can't even write a linked list anymore, right? -- http://mail.python.org/mailman/listinfo/python-list