On Aug 29, 9:43 am, Jorgen Grahn <[EMAIL PROTECTED]> wrote: > On 27 Aug 2008 15:50:14 GMT, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > > > > On Tue, 26 Aug 2008 17:04:19 -0700, tdmj wrote: > > >> On Aug 26, 5:49 pm, [EMAIL PROTECTED] wrote: > >>> I have a list that starts with zeros, has sporadic data, and then has > >>> good data. I define the point at which the data turns good to be the > >>> first index with a non-zero entry that is followed by at least 4 > >>> consecutive non-zero data items (i.e. a week's worth of non-zero data). > >>> For example, if my list is [0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9], I > >>> would define the point at which data turns good to be 4 (1 followed by > >>> 2, 3, 4, 5). > > He has a point though: this *can* be seen as a regex problem. Only a > solution which builds a string first is only good for laughs or > (possibly) quick hacks. What's missing is an RE library for lists of > objects, rather than just strings and Unicode strings. > > Not sure such a library would be worth implementing -- problems like > this one are rare, I think.
Every now and then, you see a proposal or a package for a finite state machine--- how would you encode comparing of values into a string, if you're not comparing a string? -- http://mail.python.org/mailman/listinfo/python-list