This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Dennis Sweeney, mark.dickinson, rhettinger
Date 2021-05-09.18:58:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1620586739.88.0.510443305498.issue44080@roundup.psfhosted.org>
In-reply-to
Content
FWIW, the principal use case that choices() was designed for is resampling/bootstapping.  In that use case, speed matters and small imbalances in large sequences don't matter at all.  Also, the API was designed to make it easy to select from an itemized population of individuals than a large range followed by a modulo calculation (we already have randrange() to meet that need).

I could add a sentence to the last paragraph recommending "[choice(pop) for i in range(k)]" for the case where 1)  the population is large, 2) the speed doesn't matter, 3) the weights are equal, and 4) integer math is desired to avoid any trace of bias.  That said, I don't users would benefit from it and that this is largely just a theoretical concern that doesn't warrant more than the existing paragraph.
History
Date User Action Args
2021-05-09 18:58:59rhettingersetrecipients: + rhettinger, mark.dickinson, Dennis Sweeney
2021-05-09 18:58:59rhettingersetmessageid: <1620586739.88.0.510443305498.issue44080@roundup.psfhosted.org>
2021-05-09 18:58:59rhettingerlinkissue44080 messages
2021-05-09 18:58:59rhettingercreate