Well, I think I found a nasty little hack to get around it, but I still
don't see why it doesn't work in the regular way.

def collect(fields, reducer):
    def rule(record):
        # Nasty hack b/c can't get lexical scoping of status to work
        status = [True]
        def _(x, y, s=status):
            cstat = reducer(x, y)
            if s[0] and not cstat:
                s[0] = False
            return y
        reduce(_, [record[field] for field in fields])
        return status[0]
    return rule

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to