[Scipy-tickets] [SciPy] #1293: frozen distribution incorrect kwds updating

SciPy Trac scipy-tickets@scipy....
Sun Oct 3 23:02:31 CDT 2010

#1293: frozen distribution incorrect kwds updating
 Reporter:  josefpktd    |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  normal       |   Milestone:  0.9.0   
Component:  scipy.stats  |     Version:  0.7.0   
 Keywords:               |  
 >>> import scipy
 >>> scipy.version.version
 >>> from scipy import stats
 >>> d=stats.lognorm(1)
 >>> d.moment(2)
 >>> d.stats(moments='mvsk')
 (array(1.6487212707001282), array(4.670774270471604),
 >>> d.moment(2)
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "C:\...\scipy-0.9.0.dev6579.win32\Programs\Python25\Lib\site-
 packages\scipy\stats\distributions.py", lin
 e 346, in moment
     return self.dist.moment(n,*self.args,**self.kwds)
 TypeError: moment() got an unexpected keyword argument 'moments'

 kwds update doesn't update a copy but the kwds attached to self

 345         def stats(self,moments='mv'):
 346             kwds = self.kwds
 347             kwds.update({'moments':moments})
 348             return self.dist.stats(*self.args,**kwds)

 same in rvs.

 In many cases extra kwds are ignored but moments does not take a keyword

 in frozen

 def moment(self,n): should not use **kwds in the call

 (Note: I don't think frozen distributions are fully tested, but would only
 need one test for each pattern of args, kwds)

Ticket URL: <http://projects.scipy.org/scipy/ticket/1293>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list