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 <rep...@bugs.python.org>
<http://bugs.python.org/issue15837>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to