Serhiy Storchaka added the comment:

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.

----------

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

Reply via email to