Message246636
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. |
|
Date |
User |
Action |
Args |
2015-07-12 06:57:23 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, tim.peters, rhettinger, mark.dickinson, pitrou, vstinner, steven.daprano, r.david.murray, skrah, Serge Anuchin |
2015-07-12 06:57:23 | serhiy.storchaka | set | messageid: <1436684243.15.0.515213914967.issue24567@psf.upfronthosting.co.za> |
2015-07-12 06:57:23 | serhiy.storchaka | link | issue24567 messages |
2015-07-12 06:57:22 | serhiy.storchaka | create | |
|