I am puzzled by the following (numpy 1.9.0, python 3.4.2):

In [1]: t = array(None); t[()] = array([None, None])  # Construct a 0d
array of dtype object, containing a single numpy array with 2 elements

In [2]: bool(t)
Out[2]: True

In [3]: if t: pass
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()

I thought that "if x" simply calls "bool", but apparently this is not even
the case...

Antony
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to