Author rhettinger
Recipients mark.dickinson, miss-islington, paul.moore, rhettinger, serhiy.storchaka, steven.daprano
Date 2018-05-15.10:58:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:19rhettingersetrecipients: + rhettinger, paul.moore, mark.dickinson, steven.daprano, serhiy.storchaka, miss-islington
2018-05-15 10:58:18rhettingersetmessageid: <>
2018-05-15 10:58:18rhettingerlinkissue33494 messages
2018-05-15 10:58:18rhettingercreate