[Numpy-tickets] [NumPy] #661: maximum handles nan improperly

NumPy numpy-tickets@scipy....
Thu Feb 21 21:55:17 CST 2008


#661: maximum handles nan improperly
--------------------+-------------------------------------------------------
 Reporter:  tmb     |        Owner:  somebody
     Type:  defect  |       Status:  reopened
 Priority:  normal  |    Milestone:  1.0.5   
Component:  Other   |      Version:  none    
 Severity:  normal  |   Resolution:          
 Keywords:          |  
--------------------+-------------------------------------------------------
Changes (by tmb):

  * status:  closed => reopened
  * resolution:  wontfix =>

Comment:

 Thanks.  It's good that the seterr function is there, but there's still a
 problem with the documentation and warning message.

 If you want "warn" to be the default, I'd suggest changing the error
 message to include a message about seterr:

 Warning (see numpy.seterr): invalid value encountered in maximum array([
 3. , nan, 3. ])

 I think even better would be giving context information in the warning:

 foo.py:39:warning (see numpy.seterr): "nan" value encountered in maximum

 You'd save NumPy users potentially hours of searching since seterr is
 mentioned in none of the tutorials and none of the documentation of the
 function it affects.  The documentation for seterr also doesn't contain
 keywords that might actually be found, like "floating point exception".
 And the relationship between numpy.seterr and the fpectl is unclear.

 So, concretely, my suggestion would be:

 * modify the warning message to mention numpy.seterr
 * if possible, modify the warning message to output source file and line
 number information
 * modify the documentation strings for functions affected by numpy.seterr
 to include information about what values trigger warnings and the fact
 that the behavior can be modified with numpy.seterr

 I hope you don't mind that I'm reopening the bug, but I think it's really
 important to do ''something'' about this at the documentation level, since
 an hour lost due to documentation or error messages is just as serious as
 an hour lost due to a "real" bug.

-- 
Ticket URL: <http://www.scipy.org/scipy/numpy/ticket/661#comment:2>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list