[NumPy-Tickets] [NumPy] #1740: __nonzero__ inconsistency

NumPy Trac numpy-tickets@scipy....
Thu Feb 10 15:11:29 CST 2011

#1740: __nonzero__ inconsistency
  Reporter:  pch      |       Owner:  somebody
      Type:  defect   |      Status:  closed  
  Priority:  normal   |   Milestone:  2.0.0   
 Component:  Other    |     Version:  1.5.1   
Resolution:  wontfix  |    Keywords:          
Changes (by pv):

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


 That's a design decision, essentially dating way back from Numeric. The
 truth value of ndarrays is in any case quite magical; in addition to
 treating 1-item arrays as scalars, __nonzero__ raises an error for `.size
 > 1` arrays, due to using comparison operations for generating boolean

 Gaining semantics slightly closer to Python containers does not seem a
 reason valid enough to break backward compatibility. Changing this does
 break code in Scipy, and very likely also in many 3rd party packages.

 This can be discussed further on the mailing list, if necessary.

Ticket URL: <http://projects.scipy.org/numpy/ticket/1740#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list