On Aug 27, 6:14 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Aug 27, 5:48 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > > > 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? > > And you're still wondering why do people killfile you or think you're > a failed AI project...
Just jumping on the bandwagon, George. And you see, everyone else's passed the doctests perfectly. Were all the running times O( n* k )? -- http://mail.python.org/mailman/listinfo/python-list