[ python-Bugs-1022880 ] random.shuffle should restrict the type of its argument

SourceForge.net noreply at sourceforge.net
Mon Sep 6 06:45:56 CEST 2004


Bugs item #1022880, was opened at 2004-09-06 04:45
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1022880&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Faheem Mitha (fmitha)
Assigned to: Nobody/Anonymous (nobody)
Summary: random.shuffle should restrict the type of its argument 

Initial Comment:
Consider the following
********************************************
In [1]: foo = numstr.array(['a', 'c'], shape=(2,1))
In [2]: import random
In [3]: import numarray.strings as numstr
In [4]: foo
Out[4]:
CharArray([['a'], ['c']])
In [5]: random.shuffle(foo)
In [6]: foo
Out[64]:
CharArray([['a'], ['a']])
**********************************************
The documentation says that shuffle takes a list as
argument. In this case it accepts a Numarray character
array without complaint and returns gibberish. I think
there should be some restrictions on what arguments are
accepted. Thanks.

                                                      
                    Faheem.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1022880&group_id=5470


More information about the Python-bugs-list mailing list