Numarray question
Matt Feinstein
nospam at here.com
Fri May 13 09:32:54 EDT 2005
If I try
>>> 2 < array([1,2,3])
I get:
array([0, 0, 1], type=Bool)
which is pretty slick, However if I set
>>> q = 2 < array([1,2,3])
>>> q and q
I get a runtime error: "An array doesn't make sense as a truth value."
So.. why not? It seems to me that if I could vectorize logical
expressions (a la Matlab), it would be a lot easier to write functions
that will take either scalar or vector input values. Am I missing
something?
Matt Feinstein
--
There is no virtue in believing something that can be proved to be true.
More information about the Python-list
mailing list