[SciPy-dev] Arrays as truth values?

Perry Greenfield perry at stsci.edu
Tue Nov 1 09:39:59 CST 2005

The recent question about use of "and" and "or" highlighted an issue I 
think is worth at least a little discussion (I don't recall it being 
discussed for scipy_core, but maybe it already has been).

numarray doesn't permit using arrays as truth values since we figured 
that it wasn't very clear what people expected to happen (this case is 
a good illustration). I'd like to make the argument that scipy_core 
also not permit arrays to be used as truth values (i.e., one should get 
an exception if one tries to use it that way). I realize that this will 
break some old code, but since incompatible changes are being made, 
this is the time to make this sort of change.  If left in, it is going 
to bite people, often quietly.


More information about the Scipy-dev mailing list