New submission from Steven D'Aprano <steve+pyt...@pearwood.info>:

As mentioned on the Python-List:

https://mail.python.org/pipermail/python-list/2018-May/733061.html

random.choices() silently returns the wrong values when cumulative weights are 
not given, i.e. if the user misreads the documentation and provides 
non-cumulative weights, expecting that cumulative weights will be constructed 
for them.

I think that the documentation should be more clear, and preferably the 
choices() function ought to fail early when given invalid weights.

----------
components: Library (Lib)
messages: 316499
nosy: mark.dickinson, rhettinger, steven.daprano
priority: normal
severity: normal
status: open
title: random.choices ought to check that cumulative weights are in ascending 
order
type: enhancement
versions: Python 3.8

_______________________________________
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