Strange error message when calling random in Py1.5

William Tanksley wtanksle at
Mon May 8 18:32:29 CEST 2000

On 07 May 2000 21:06:20 -0400, Alex wrote:

>> >>> import random
>> >>> random.random(100)
>> Traceback (innermost last):
>>    File "<pyshell#1>", line 1, in ?
>> 	random.random(100)
>> TypeError: too many arguments; expected 1, got 2
>> >>> 

>> Whew.  This one's not believable.  Any ideas?

>...I always thought the fact that the "TypeError: too many arguments"
>error is off by one for bound methods was very misleading.  It confused
>the hell out of me one afternoon...

Well, it just did the same to me.  Especially since I had originally typed
that as "random(0,255)" and got the EXACT same message (expected 1, got 2).

>It seems as if random.random is not meant to take any arguments, and
>returns a random float between 0 and 1:

Slap.  So I wanted randint, not random.  Okay, it's all working now.



-William "Billy" Tanksley

More information about the Python-list mailing list