2008/4/18, Olivier Verdier <[EMAIL PROTECTED]>:
>
> I certainly didn't mean that "A==B" should return a boolean!!
>
> "A==B" should return an array of boolean as it does now. This is all
> right.
>
> *However* "bool(A==B)" should return a boolean, *not* raise an
> exception. Why raise an exception? What is ambiguous about
> "bool(A==B)"??
>
> This is what happens when you write "if A==B" because then
> "bool(A==B)" is somehow triggered and bang, an exception is raised.
>
> As I tried to explain, the default behaviour should be that "bool(A)"
> return "A.all()" but not an exception. Why is there an exception
> raising at all?


Sometimes, you want .all(), sometimes .any(). It really depends on the
question you are asking. Even for bool(A), there is no easy answer. In some
case I want True if some elements are true, in other cases only if all
elements are true.
I would agree with you some years ago, but after using bool(A) = A.all(), I
started noticing that it brakes my coding instead of speeding it and does
not give me any benefit at all.

Matthieu
-- 
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to