derrynknife / SurPyval

A Python package for survival analysis. The most flexible survival analysis package available. SurPyval can work with arbitrary combinations of observed, censored, and truncated data. SurPyval can also fit distributions with 'offsets' with ease, for example the three parameter Weibull distribution.
https://surpyval.readthedocs.io/en/latest/index.html
MIT License
48 stars 5 forks source link

[JOSS review] __str__ vs __repr__ in classes #5

Closed CamDavidsonPilon closed 3 years ago

CamDavidsonPilon commented 3 years ago

In an IPython console, the following produces different results:

> model
> print(model)

Take a look at __repr__ instead of using [__str__] (https://github.com/derrynknife/SurPyval/blob/768595da11fa15410c3ad5b44bb1a7caf615b9e7/surpyval/parametric/offset_parametric.py#L23) to align these

derrynknife commented 3 years ago

Thanks @CamDavidsonPilon, I've change the offset parametric and parametric classes to use __repr__ instead of __str__