[Scipy-tickets] [SciPy] #1316: j.reid@mail.cryst.bbk.ac.uk

SciPy Trac scipy-tickets@scipy....
Tue Oct 19 09:08:13 CDT 2010


#1316: j.reid@mail.cryst.bbk.ac.uk
----------------------+-----------------------------------------------------
 Reporter:  JohnReid  |       Owner:  somebody
     Type:  defect    |      Status:  new     
 Priority:  normal    |   Milestone:  0.9.0   
Component:  Other     |     Version:  devel   
 Keywords:            |  
----------------------+-----------------------------------------------------
 Using the latest scipy svn version (6845) I had the following ipython
 session:

 In [1]: import scipy.stats.distributions

 In [2]: scipy.stats.distributions.gamma_gen( name = 'gamma' )
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call
 last)

 /home/john/local/src/<ipython console> in <module>()

 /usr/local/lib/python2.6/dist-packages/scipy/stats/distributions.pyc in
 __init__(self, momtype, a, b, xa, xb, xtol, badvalue, name, longname,
 shapes, extradoc)
      963         # generate docstring for subclass instances

      964         if self.__doc__ is None:
 --> 965             self._construct_default_doc(longname=longname,
 extradoc=extradoc)
      966         else:
      967             self._construct_doc()

 /usr/local/lib/python2.6/dist-packages/scipy/stats/distributions.pyc in
 _construct_default_doc(self, longname, extradoc)
      972     def _construct_default_doc(self, longname=None,
 extradoc=None):
      973         """Construct instance docstring from the default
 template."""
 --> 974         if extradoc.startswith('\n\n'):
      975             extradoc = extradoc[2:]
      976         self.__doc__ = ''.join(['%s continuous random
 variable.'%longname,

 AttributeError: 'NoneType' object has no attribute 'startswith'


 The following patch fixes it:

 Index: scipy/stats/distributions.py
 ===================================================================
 --- scipy/stats/distributions.py        (revision 6845)
 +++ scipy/stats/distributions.py        (working copy)
 @@ -971,6 +971,8 @@

       def _construct_default_doc(self, longname=None, extradoc=None):
           """Construct instance docstring from the default template."""
 +        if None == extradoc:
 +            extradoc = ""
           if extradoc.startswith('\n\n'):
               extradoc = extradoc[2:]
           self.__doc__ = ''.join(['%s continuous random
 variable.'%longname,

 See the thread:
 http://permalink.gmane.org/gmane.comp.python.scientific.user/26578

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


More information about the Scipy-tickets mailing list