[SciPy-user] [Numpy-discussion] initialise an array
oliphant.travis at ieee.org
Tue Jan 10 09:54:05 CST 2006
> I have a function like this:
> def test(x,xall=None):
> if xall == None: xall =x
> I obtain this error message when I'm doing this with numpy (I don't
> have this problem with numarray and Numeric).
> ValueError: The truth value of an array with more than one element is
> ambiguous. Use a.any() or a.all
You probably want to do
if xall is None: xall = x
This will not only be faster but will also not be ambiguous.
More information about the SciPy-user