Raymond Hettinger added the comment: I concur with Antoine. A list comprehension is the standard, obvious idiom for making a list from repeated function calls.
Putting sampling without replacement in its own method makes the operation more opaque than a plain list comprehension (which doesn't need documentation to be clear about how many calls are made, what the output type is, its relationship to random.choice, whether k can be larger than the population, etc). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18414> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com