[SciPy-Dev] Rationale behind *_gen and *_frozen in _multivariate.py

Robert Kern robert.kern at gmail.com
Wed Jul 27 09:26:23 EDT 2016


On Wed, Jul 27, 2016 at 2:04 PM, <josef.pktd at gmail.com> wrote:
>
> On Wed, Jul 27, 2016 at 8:44 AM, Robert Kern <robert.kern at gmail.com>
wrote:
> > On Wed, Jul 27, 2016 at 12:36 PM, <josef.pktd at gmail.com> wrote:

> >> some history in the following, Evgeni knows better the recent changes
> >>
> >> The original implementation of the distributions was mostly
> >> "functional". Classes are used as namespace and to make implementation
> >> easier, but users only used a single global instance of the
> >> distribution classes.
> >>
> >> Because it is only a single global instance it cannot keep state, i.e.
> >> store intermediate results and parameters as attributes. This was a
> >> headache and source of bugs when state spilled over in the global
> >> instance from one use to the next.
> >
> > That's not quite right, I don't think. Only the multivariate
distributions,
> > which are quite new, store intermediate results. No global state was
ever
> > stored in the "unfrozen" distribution instances. Storing intermediate
> > results were not a consideration in adding frozen distributions.
>
> It took me a few months to figure out why the distributions sometimes
> produces different, i.e. wrong, results, and to fix those bugs. Using
> attributes and state might not have been the plan, but it was and is
> in the actual implementation.
>
> (And it's the source of my allergy to the possibility of stale state
> in statsmodels.)

I'm pretty sure that we had frozen distributions before you encountered
those bugs. We didn't add frozen distributions to get rid of those bugs. We
added them for the API reasons I described.

https://mail.scipy.org/pipermail/scipy-user/2003-October/002278.html

--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20160727/5aee53ed/attachment.html>


More information about the SciPy-Dev mailing list