lbl-anp / becquerel

Becquerel is a Python package for analyzing nuclear spectroscopic measurements.
Other
43 stars 16 forks source link

replace calls to Spectrum() with self.__class__() etc. #404

Closed jvavrek closed 5 months ago

jvavrek commented 5 months ago

Throughout Spectrum (and probably other classes) there are many points where a Spectrum method returns a new Spectrum object by doing return Spectrum(...). However this is kind of bad practice as downstream users may derive their own classes from Spectrum, in which case Spectrum methods will return a Spectrum rather than the subclass.

The fix is simple: replace calls to Spectrum() (etc.) with self.__class__()