Henk-Jaap Wagenaar <wagenaarhenkj...@gmail.com> added the comment:

@rhettinger: I like this proposal.

@dheiberg: to me, it seems negative weights are explicitly not supported, from: 
https://docs.python.org/3/library/random.html#random.choices

"Weights are assumed to be non-negative."

Unless I am missing something. In my mind negative weights make no sense and 
the fact it produces garbage in your example is garbage-in-garbage-out.

Maybe an enhancement could be made (but it would be breaking for some abusing 
the behaviour you showed) for it to error (or do something sane? If such a 
thing exists) but that should be a separate issue.

----------
nosy: +cryvate

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

Reply via email to