Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
This was an intentional decision. It is documented and tested. The rationale is that is keeps choices() internally consistent so that choices with equal weights produces the same result as if no weights are specified. For anyone who wants an alternative, it is trivial just call choice() in a list comprehension: [choice(seq) for i in range(k)] Another thought is that choices() is more performant than calling choice() in a loop. This matters because one of the principal use cases for choices() in bootstrapping where choices() can be called many times. Lastly, we are strongly averse to changing the algorithms after they are published because it impacts reproducible research where people need to be able to recreate their random selections for a given seed. ---------- nosy: +rhettinger resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue47114> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com