Message196711
The sticking point is going to be that we don't want to recompute the cumulative weights for every call to weighted_choice.
So there should probably be two functions:
cw = make_cumulate_weights(weight_list)
x = choice(choice_list, cw)
This is similar to what was done with string.maketrans() and str.translate(). |
|
Date |
User |
Action |
Args |
2013-09-01 05:43:42 | rhettinger | set | recipients:
+ rhettinger, tim.peters, mark.dickinson, pitrou, aisaac, serhiy.storchaka, madison.may |
2013-09-01 05:43:42 | rhettinger | set | messageid: <1378014222.58.0.103201321318.issue18844@psf.upfronthosting.co.za> |
2013-09-01 05:43:42 | rhettinger | link | issue18844 messages |
2013-09-01 05:43:42 | rhettinger | create | |
|