'and' is not exactly an 'operator' (was Re: numpy.where() and multiple comparisons)

2014-01-18 Thread Terry Reedy
On 1/18/2014 3:50 AM, Peter Otten wrote: Unlike `&` `and` cannot be overridden (*), (*) I assume overriding would collide with short-cutting of boolean expressions. Yes. 'and' could be called a 'control-flow operator', but in Python it is not a functional operator. A functional binary op

Re: numpy.where() and multiple comparisons

2014-01-18 Thread Tim Roberts
Peter Otten <__pete...@web.de> wrote: >John Ladasky wrote: > >> On Friday, January 17, 2014 6:16:28 PM UTC-8, duncan smith wrote: >> >>> >>> a = np.arange(10) >>> >>> c = np.where((2 < a) & (a < 7)) >>> >>> c >>> (array([3, 4, 5, 6]),) >> >> Nice! Thanks! >> >> Now, why does the multiple co

Re: numpy.where() and multiple comparisons

2014-01-18 Thread Peter Otten
John Ladasky wrote: > On Friday, January 17, 2014 6:16:28 PM UTC-8, duncan smith wrote: > >> >>> a = np.arange(10) >> >>> c = np.where((2 < a) & (a < 7)) >> >>> c >> (array([3, 4, 5, 6]),) > > Nice! Thanks! > > Now, why does the multiple comparison fail, if you happen to know? 2 < a < 7 i

Re: numpy.where() and multiple comparisons

2014-01-17 Thread John Ladasky
On Friday, January 17, 2014 6:16:28 PM UTC-8, duncan smith wrote: > >>> a = np.arange(10) > >>> c = np.where((2 < a) & (a < 7)) > >>> c > (array([3, 4, 5, 6]),) Nice! Thanks! Now, why does the multiple comparison fail, if you happen to know? -- https://mail.python.org/mailman/listinfo/pyth

Re: numpy.where() and multiple comparisons

2014-01-17 Thread duncan smith
On 18/01/14 01:51, John Ladasky wrote: Hi folks, I am awaiting my approval to join the numpy-discussion mailing list, at scipy.org. I realize that would be the best place to ask my question. However, numpy is so widely used, I figure that someone here would be able to help. I like to use n