Mercurial > code > home > repos > light9
view light8/util.py @ 33:d9a0f6c88b39
Fix bad refs to quit
author | dmcc |
---|---|
date | Sun, 07 Jul 2002 10:55:05 +0000 |
parents | f974a462133f |
children | 62c47c3a90cb |
line wrap: on
line source
def maxes(dicts): ''' ({'a' : 5, 'b' : 9}, {'a' : 10, 'b' : 943}) ''' newdict = {} for d in dicts: for k,v in d.items(): newdict[k] = max(v, newdict.get(k, 0)) return newdict def scaledict(d,scl): # scales all values in dict and returns a new dict return dict([(k,v*scl) for k,v in d.items()]) # class Setting that scales, maxes