Mercurial > code > home > repos > light9
annotate 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 |
rev | line source |
---|---|
4 | 1 |
0 | 2 def maxes(dicts): |
3 ''' | |
4 ({'a' : 5, 'b' : 9}, {'a' : 10, 'b' : 943}) | |
5 ''' | |
6 newdict = {} | |
7 for d in dicts: | |
8 for k,v in d.items(): | |
9 newdict[k] = max(v, newdict.get(k, 0)) | |
10 return newdict | |
11 | |
12 def scaledict(d,scl): | |
13 # scales all values in dict and returns a new dict | |
14 return dict([(k,v*scl) for k,v in d.items()]) | |
15 | |
16 # class Setting that scales, maxes |