Nice to know about random.sample! =) I think what OP said can then be reduced to having the default k in random.sample to be the iterable size. The existance of random.sample is a very strong argument against "shuffled", and the only "feature" shuffled would have that random.sample doesn't have is that default size.
You cannot sort a sequence lazily > You can, but it probably wouldn't be efficient if you need all the values. On the other hand, if you need just the 3 smaller values of a huge list... well, that's another topic. 2016-09-08 0:28 GMT-03:00 Nick Coghlan <ncogh...@gmail.com>: > On 8 September 2016 at 13:23, Nick Coghlan <ncogh...@gmail.com> wrote: > > > Beyond that practical benefit, if you want > > random-sampling-with-replacement, then "map(random.choice, container)" > > Oops, that was supposed to be "map(random.choice, > itertools.repeat(container))". > > Cheers, > Nick. > > -- > Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia > -- Danilo J. S. Bellini --------------- "*It is not our business to set up prohibitions, but to arrive at conventions.*" (R. Carnap)
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/