[SciPy-Dev] Design of scipy.stats

josef.pktd at gmail.com josef.pktd at gmail.com
Thu May 20 17:03:51 EDT 2010


On Thu, May 20, 2010 at 4:26 PM, David Goldsmith
<d.l.goldsmith at gmail.com> wrote:
> On Thu, May 20, 2010 at 12:03 PM, <josef.pktd at gmail.com> wrote:
>>
>> On Thu, May 20, 2010 at 2:53 PM, David Goldsmith
>> <d.l.goldsmith at gmail.com> wrote:
>> > So then that's actually the one that should be documented?  Or they both
>> > should?  (Forgive me if I sound ignorant, but I'm not familiar w/ this
>> > API
>> > model: I'm use to the library/package/module providing the class, as in
>> > "class library," and then the user instantiating (or sub-classing) that
>> > as
>> > s/he needs; I've never heard of an "instance library.")  Thanks again!
>>
>> the docstrings are attached to or generated for the classes. The
>> instances get the docstrings from the class, and don't have separate
>> docstrings.
>>
>> The instances are created for convenience (especially for users who
>> are not familiar with classes).
>>
>> Josef
>
> OK, so if I do help(alpha) for example, here's what I get:
>
> Help on alpha_gen in module scipy.stats.distributions object:
>
> class alpha_gen(rv_continuous)
>  |  ## Alpha distribution
>  |  ##
>  |
>  |  Method resolution order:
>  |      alpha_gen
>  |      rv_continuous
>  |      rv_generic
>  |      __builtin__.object
>  |
>  |  Methods inherited from rv_continuous:
> ...
>
> Am I the only one who thinks this might be confusing to a user (esp. one who
> is "not familiar w/ classes")?
>
> Forgive me for persisting, but what's the design rationale here?  In
> particular, why is making an instance (which actually appears to be a class
> if one asks for help about it) the basis for the API seen as being more
> "approachable" than a class - IME, neither is a common programming concept
> outside of OO design, so what advantage does one have over the other for an
> OO novice?

The discussion between Pierre and me last August on the scipy-user
mailing list might be informative.

As for why it was written this way: I don't know

Josef

>
> DG
>>
>>
>> >
>> > DG
>> >
>> > On Thu, May 20, 2010 at 11:24 AM, Robert Kern <robert.kern at gmail.com>
>> > wrote:
>> >>
>> >> On Thu, May 20, 2010 at 13:22, David Goldsmith
>> >> <d.l.goldsmith at gmail.com>
>> >> wrote:
>> >> > On Thu, May 20, 2010 at 8:12 AM, David Huard <david.huard at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> <X>_gen is a class and <X> an instance of that class.
>> >> >>
>> >> >> David H.
>> >> >
>> >> > So which is a user expected to use?
>> >>
>> >> The latter.
>> >>
>> >> --
>> >> 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
>> >> _______________________________________________
>> >> SciPy-Dev mailing list
>> >> SciPy-Dev at scipy.org
>> >> http://mail.scipy.org/mailman/listinfo/scipy-dev
>> >
>> >
>> >
>> > --
>> > Mathematician: noun, someone who disavows certainty when their
>> > uncertainty
>> > set is non-empty, even if that set has measure zero.
>> >
>> > Hope: noun, that delusive spirit which escaped Pandora's jar and, with
>> > her
>> > lies, prevents mankind from committing a general suicide.  (As
>> > interpreted
>> > by Robert Graves)
>> >
>> > _______________________________________________
>> > SciPy-Dev mailing list
>> > SciPy-Dev at scipy.org
>> > http://mail.scipy.org/mailman/listinfo/scipy-dev
>> >
>> >
>> _______________________________________________
>> SciPy-Dev mailing list
>> SciPy-Dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
>
>
> --
> Mathematician: noun, someone who disavows certainty when their uncertainty
> set is non-empty, even if that set has measure zero.
>
> Hope: noun, that delusive spirit which escaped Pandora's jar and, with her
> lies, prevents mankind from committing a general suicide.  (As interpreted
> by Robert Graves)
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
>



More information about the SciPy-Dev mailing list