[New-bugs-announce] [issue15837] Added test to test_random.py testing Random.shuffle
Alessandro Moura
report at bugs.python.org
Sat Sep 1 04:06:19 CEST 2012
New submission from Alessandro Moura:
Random.shuffle does not have a test in test_random.py; the attached patch adds this test. In addition, I rewrote the documentation string for Random.shuffle, which apparently did not reflect recent changes in the code and was inconsistent with the definition of the method. This change is also part of this patch; I was not sure if this merited a separate issue, so I just included this here.
On a related matter: in Random.shuffle there is a third optional argument which looks very odd to me:
def shuffle(self, x, random=None, int=int):
....
Besides being confusing to a user typing help(shuffle), what the "int" argument does in shuffle is to convert a float to an integer. But one could pass any one-argument function in principle, and it would be then very hard to predict what shuffle would do... it would not "shuffle" any more in the traditional sense - not with a uniform probability distribution. In summary, I don't see how that argument could be useful, although the people who wrote the library must have had something in mind... if so it would be a good idea to document it.
----------
components: Tests
messages: 169603
nosy: eng793
priority: normal
severity: normal
status: open
title: Added test to test_random.py testing Random.shuffle
type: enhancement
versions: Python 3.3
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15837>
_______________________________________
More information about the New-bugs-announce
mailing list