def addAggregators(cols, aggrnames):
    'add aggregator for each aggrname to each of cols'
    for aggrname in aggrnames:
        aggrs = aggregators.get(aggrname)
        aggrs = aggrs if isinstance(aggrs, list) else [aggrs]
        for aggr in aggrs:
            for c in cols:
                if not hasattr(c, 'aggregators'):
                    c.aggregators = []
                if aggr and aggr not in c.aggregators:
                    c.aggregators += [aggr]
def addAggregators ( cols , aggrnames ) : for aggrname in aggrnames : aggrs = aggregators . get ( aggrname ) aggrs = aggrs if isinstance ( aggrs , list ) else [ aggrs ] for aggr in aggrs : for c in cols : if not hasattr ( c , 'aggregators' ) : c . aggregators = [ ] if aggr and aggr not in c . aggregators : c . aggregators += [ aggr ]
add aggregator for each aggrname to each of cols