[SciPy-Dev] Design of scipy.stats

David Goldsmith d.l.goldsmith at gmail.com
Thu May 20 16:26:00 EDT 2010


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?

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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20100520/c7f11c33/attachment.html>


More information about the SciPy-Dev mailing list