[EMAIL PROTECTED] wrote: > reducer does have no side effects so I suppose short-circuting it would > be the best thing. I think the only thing about the last example is > that it starts things off with a zero. I think that would boink it.
In that case, and assuming that fields contains at least one entry: def collect(fields, reducer): def rule(record): f = iter(fields) prev = record[f.next()] for field in f: if not reducer(prev, record[field]): return False prev = record[field] return True return rule -- http://mail.python.org/mailman/listinfo/python-list