Marc Shivers <marc.shivers <at> gmail.com> writes:

> 
> you could use bitwise comparison with paretheses:  In [8]: (a>4)&(a<8)Out[8]: 
array([False, False, False, False, False,  True,  True,  True, False,       
False, False], dtype=bool)
> 

For cases like this I find it very useful to define a function between() - e.g. 
https://bitbucket.org/nhmc/pyserpens/src/4e2cc9b656ae/utilities.py#cl-88

Then you can use 

between(a, 4, 8) 

instead of 

(4 < a) & (a < 8), 

which I find less readable and more difficult to type.

Neil

_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to