[Numpy-discussion] logical priority

Stephen Walton stephen.walton at csun.edu
Wed Feb 9 10:13:41 EST 2005


Fernando Perez wrote a good deal clarifying how Python's logical 
operators work, for which I'm grateful.  One brief comment:

> Bytecode analysis can be really useful to understand this kind of 
> subtle issues.  I can't think of any language where this approach is 
> as easy to do and friendly as in python.

Pardon me, but this sounds a bit like looking at the assembly language 
Fortran generates in order to understand the subtleties of that language 
:-) .  I know people who used to do that, and were proud of it, but I'd 
rather the language itself didn't behave in surprising ways.  At least 
in Fortran, 'a .and. b' only made sense if a and b were both of type 
LOGICAL;  in fact, it was a compile time error if they weren't.

Anyway, we've wandered afar from the main point:  what is the best way 
to duplicate the functionality of the following MATLAB snippet:

f = ~isnan(data1) & ~isnan(data2);
plot(x,data1(f),x,data2(f))

?





More information about the NumPy-Discussion mailing list