[SciPy-dev] Problem with stats.distributions.randint

Otto Tronarp otttr440 at student.liu.se
Fri Jan 24 08:28:13 CST 2003


Hi,

I'm having problem with stats.distributions.randint, I get the following
traceback:

>>> ri = scipy.stats.distributions.randint(0,5)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/home/zzap/sandbox/py-lib/lib/python2.2/site-packages/scipy/stats/distri
butions.py", line 2727, in __call__
    U = rv.random(size=self._size)
AttributeError: 'module' object has no attribute 'random'

So I took a look in rv.py and I couldn't find any there. By the look of
the cvslog it seems like a lot of functionality was moved from rv to
distributions about 2 month ago and by the look of it random was moved
so I tried to change that line to
U = random(size=self._size)
But now I get:
 ri=scipy.stats.distributions.randint(0,5)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/home/zzap/sandbox/py-lib/lib/python2.2/site-packages/scipy/stats/distributions.py", line 2727, in __call__
    U = random(size=self._size)
AttributeError: randint_gen instance has no attribute '_size'

Poking around in the source a little more it seem like the only place
where self._size is set is in rv_discrete.rvs and that one is called
from rvc_discrete.__call__, but since randint_gen overides the __call__
method it's never set.

Am I correct in my analysis? If so is the attached patch the correct
cure?


Regards,
Otto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: randintfix.patch
Type: text/x-patch
Size: 1205 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20030124/c2b2d20c/attachment.bin 


More information about the Scipy-dev mailing list