[Numpy-discussion] logical priority

Travis Oliphant oliphant at ee.byu.edu
Mon Feb 7 21:19:25 CST 2005


Stephen Walton wrote:

> konrad.hinsen at laposte.net wrote:
>
>> Operator priorities are part of the Python language and implemented 
>> in  the parser. Numarray cannot interfere with that.
>
>
> In Python, of course, & is a bitwise AND, logical and being the 
> literal word "and".  & has lower operator priority than <, but "and" 
> has a higher one.
>
> I think the real problem is that "and" doesn't work on numarray bool 
> arrays in an element-wise fashion as I expected;  perhaps it should?  
> Otherwise constructs like

Currently, I don't think Python allows "over-riding" the "and" 
operation.  It only works on the truth or falseness of the objects.  
Therefore, I don't think it is possible to make it work as you'd expect 
unless Python is changed.






More information about the Numpy-discussion mailing list