[Numpy-discussion] Multiple Boolean Operations

Travis E. Oliphant oliphant@enthought....
Thu May 22 10:07:11 CDT 2008


Alan G Isaac wrote:
> On Thu, 22 May 2008, Andrea Gavana apparently wrote:
>   
>> # Filter cells which do not satisfy Z requirements:
>> zReq = zMin <= zCent <= zMax 
>>     
>
> This seems to raise a question:
> should numpy arrays support this standard Python idiom?
>   
It would be nice, but alas it requires a significant change to Python 
first to give us the hooks to modify.   (We need the 'and' and 'or' 
operations to return "vectors" instead of just numbers as they do 
now).     There is a PEP to allow this, but it has not received much TLC 
as of late.   The difficulty in the implementation is supporting 
"short-circuited" evaluation. 

-Travis





More information about the Numpy-discussion mailing list