Message316637
I concur with Serhiy. The proposed check would cripple the intended use of cumulative weights which is provided as a way to avoid the cost of rebuilding the weights on every call. FWIW, bisect() has a long history of requiring sorted inputs and has a similar possibility of misuse, but it too would cripple its core use case if it were to have to validate that the user input was sorted.
I'm open to a docs change but am dubious that that would have helped the OP on python-ideas. The docs already have a specific example showing the relationship between weights and cum_weights, as well as indicating that the purpose of cum_weights is to save the work of computing the weights accumulation. There is an additional example in the recipes section. |
|
Date |
User |
Action |
Args |
2018-05-15 10:58:19 | rhettinger | set | recipients:
+ rhettinger, paul.moore, mark.dickinson, steven.daprano, serhiy.storchaka, miss-islington |
2018-05-15 10:58:18 | rhettinger | set | messageid: <1526381898.96.0.682650639539.issue33494@psf.upfronthosting.co.za> |
2018-05-15 10:58:18 | rhettinger | link | issue33494 messages |
2018-05-15 10:58:18 | rhettinger | create | |
|