Mercurial > code > home > repos > light9
view light8/util.py @ 26:219d6fcbc28d
Reclassification, minor cleanups
Reclassification, minor cleanups
No more global variables in rsn! They are all in a class called
LightBoard.
author | dmcc |
---|---|
date | Sun, 07 Jul 2002 08:33:52 +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