[Numpy-discussion] numpy.random.permutation bug?

Robert Kern robert.kern at gmail.com
Thu Jan 18 11:51:27 CST 2007


Keith Goodman wrote:
> On 1/18/07, Robert Kern <robert.kern at gmail.com> wrote:
>> Keith Goodman wrote:
>>> I don't think that bug is particular to int32. For example:
>>>
>>>>> numpy.random.permutation(1.2)
>>> TypeError: len() of unsized object
>> Well, that should raise an error, though maybe not that error.
> 
> Is my example any different than the one given by Emanuele? He passed
> in a.sum().
> 
>>> numpy.random.permutation(1)
> array([0])
>>> numpy.random.permutation(1.2)
> TypeError: len() of unsized object

Yes. 1.2 is not an integer. In Emanuele's example, a.sum() was an integer,
though not an int.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list