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

Otto Tronarp otttr440 at student.liu.se
Mon Jan 27 20:41:09 EST 2003


On Mon, 2003-01-27 at 23:51, eric jones wrote:
> > 
> > Ona Sun, 2003-01-26 at 22:28, eric jones wrote:
> >
[snip]
>  
> > I don't quite understand what you mean. (My English isn't the best..)
> 
> Neither is mine, but I'm betting you have a better excuse than I
> do...:-)
> > 
> > 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.
> 
> I was thinking about continuous distributions also -- not just discrete
> ones, so it was my misunderstanding.  The behavior you are asking for
> sounds right to me.
> 

Ahh ok, then you're statement makes more sense to me. I see that travo
(Travis?) already has checked in this in the cvs.

> > 
> > If I understand you correctly you want to keep it like it was before,
> > or?
> > 
> > > >
> > > > 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.
> >

The tiny attached patch (randin_asarry.patch) fixes that, since randint
seems to be the only one the deviates from that.

I also attached the current state of my patch for the unit tests so you
can have look at it. I won't have any time to continue working on it for
the nearest weeks. They will probably fail for a lot of the
distributions if you don't check in my patch that fixes the missing
_check_shape in rv.py. They currently check that the result are of
correct size, in the right domain, that it is ints and that they return
an array even for size=1. I stayed consistent with neighbouring code for
calling Numeric. Maybe when all the unit tests are in place some one
could go over the code to stream line it to the recommended way.


Regards, 
Otto

-------------- next part --------------
A non-text attachment was scrubbed...
Name: randint_asarry.patch
Type: text/x-patch
Size: 595 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20030128/90862a4a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: discrete_rsv_tests.patch
Type: text/x-patch
Size: 5990 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20030128/90862a4a/attachment-0001.bin>


More information about the SciPy-Dev mailing list