[SciPy-dev] Inconsisten return type from discrete dists.

Otto Tronarp otttr440 at student.liu.se
Mon Jan 27 14:56:53 CST 2003

On Sun, 2003-01-26 at 22:28, eric jones wrote:
> > discovered that the return type from discrete distributions where
> > inconsistent or rather they all seems to return floats except for
> > randint. Further, some of them also returns a array of length 1 when
> > called without size argument while others return a simple number.
> > 
> > For the first issue I feel that it is more natural for them to return
> > ints, the attached patch, return_ints.pathc, fixes that.
> So you're saying that everything continues to return floats except for
> randint which returns ints?  If so, then I agree.

I don't quite understand what you mean. (My English isn't the best..)

Before it was like this: More than one of the discrete distributions
returned floats (I did only test a couple of them) and at least one
(randint) return integers.

I want them all to return integers and that's what my patch is doing.
That is what I would expect them to do, but maybe there are other
applications where floats are more sensible that I don't see.

If I understand you correctly you want to keep it like it was before,

> > 
> > For the second issue I think that it is more convenient if they always
> > returns an array. I have no patch for that, but I can fix it if that
> is
> > the consensus.
> Yes, this sounds appropriate.

Ok, I'll prepare a patch for this then.


> Otto, if you would like CVS access to add your tests, let me know.  

As long as I'm just doing smal patches I'm perfectly fine with sending
patches to the list. But I would like do more substantial contributions
in the future and then it would be nice with CVS access. I'll need to
finish my master thesis first though and I'm going on vacation later in
the week so I won't have any time to do any real work before the end of

Concerning the unit tests, I have written tests for the rsv's now that
check's that the result is in the right domain and of right type/size. I
then plan to move on with tests for the pdf and cdf. I haven't yet
decided on how to them, but I was thinking of calculating them with a
"known good" implementation of them and compare to that. Any other


More information about the Scipy-dev mailing list