Message196721
[Raymond Hettinger]
> 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)
That's pretty much how I broke things up when I decided to test out optimization with lru_cache. That version of the patch is now attached.
[Serhiy Storchaka]
> I like the idea about adding a family of distribution generators.
> They should check input parameters and make a precomputation and then > generate infinite sequence of specially distributed random numbers.
Would these distribution generators be implemented internally (see attached patch) or publicly exposed? |
|
Date |
User |
Action |
Args |
2013-09-01 14:37:04 | madison.may | set | recipients:
+ madison.may, tim.peters, rhettinger, mark.dickinson, pitrou, aisaac, westley.martinez, serhiy.storchaka |
2013-09-01 14:37:04 | madison.may | set | messageid: <1378046224.47.0.370545684575.issue18844@psf.upfronthosting.co.za> |
2013-09-01 14:37:04 | madison.may | link | issue18844 messages |
2013-09-01 14:37:04 | madison.may | create | |
|