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 serhiy.storchaka
Recipients Serge Anuchin, mark.dickinson, pitrou, r.david.murray, rhettinger, serhiy.storchaka, skrah, steven.daprano, tim.peters, vstinner
Date 2015-07-12.06:57:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1436684243.15.0.515213914967.issue24567@psf.upfronthosting.co.za>
In-reply-to
Content
Unfortunately a link to Rietveld is not available for review and inlined comments.

In sample() the selected set can be initialized to {n} to avoid additional checks in the loop for large population. In the branch for small population, non-empty pool can be extended ("pool.append(pool[-1])") to avoid additional check in the loop.

In choice() I would write the condition as "i == n > 0" to avoid indexing with negative index. Custom collection can has non-standard behavior with negative indices. This doesn't add additional cost in normal case.
History
Date User Action Args
2015-07-12 06:57:23serhiy.storchakasetrecipients: + serhiy.storchaka, tim.peters, rhettinger, mark.dickinson, pitrou, vstinner, steven.daprano, r.david.murray, skrah, Serge Anuchin
2015-07-12 06:57:23serhiy.storchakasetmessageid: <1436684243.15.0.515213914967.issue24567@psf.upfronthosting.co.za>
2015-07-12 06:57:23serhiy.storchakalinkissue24567 messages
2015-07-12 06:57:22serhiy.storchakacreate