Instance of scipy.stats.rv_discrete subclass throws error on pmf() method
问题 I want to create a subsclass of scipy.stats.rv_discrete to add some additional methods. However, when I try to access the pmf() method of the subclass, an error is raised. Please see the following example: import numpy as np from scipy import stats class sub_rv_discrete(stats.rv_discrete): pass xk = np.arange(2) pk = (0.5, 0.5) instance_subclass = sub_rv_discrete(values=(xk, pk)) instance_subclass.pmf(xk) This results in: Traceback (most recent call last): File "<ipython-input-48-129655c38e6a