I'm using various rv_continuous distributions as priors for a Bayesian analysis package I'm writing. Part of the GUI functionality is to produce code fragments from the GUI state to encourage scientific reproducibility. i.e. set up the analysis objects in a GUI, then output code that could be run from a script. I'm making a lot of use of __repr__ to produce text that can be used to build the objects. However, I'm stalled at recreating the scipy.stats distributions, and would like to propose that the __repr__ of these classes be improved to a point where the repr can be used to reproduce the distribution.

e.g instead of:

>>> from scipy.stats import norm
>>> print(repr(norm(0, 1)))
<scipy.stats._distn_infrastructure.rv_frozen object at 0x1a17c8f898>

one would get:
norm(0, 1)

This would require that all the initialisation variables be accessible from the object (which I think was discussed recently if I remember rightly).

Would others find thisĀ useful?

Andrew.


--
_____________________________________
Dr. Andrew Nelson


_____________________________________