Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

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.

----------
assignee:  -> rhettinger
components: +Documentation -Library (Lib)

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33494>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to