[Numpy-discussion] logical priority

Colin J. Williams cjw at sympatico.ca
Tue Feb 8 04:58:37 CST 2005


Travis Oliphant wrote:

> 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.
>
>
There is __nonzero__ which could be treated as allTrue or someTrue, the 
former is probably the better.

Colin W.

>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>





More information about the Numpy-discussion mailing list