On 9/13/2009 7:46 AM, Robert wrote:
> 2 ways seem to be consistently Pythonic and logical: "size>
> 0"; or "any(a)" (*); and the later option may be more 'numerical'.

Well, *there's* the problem.

As a user I have felt more than once that a
length based test, like other containers, would
be natural, so I that I could do the usual test
        if a:
That would certainly prove problematic for
the `any` test when a is an array of zeros.
And  then soon after I want to use
        if (a>0):
and that would certainly prove problematic for
the `len` test when (a>0) is an array of zeros.
And as for the `any` test, well in this case I
usually want `all`.

So the ValueError has proved useful.

Alan Isaac
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to