[Numpy-discussion] where construct

Hans Meine meine@informatik.uni-hamburg...
Thu Dec 20 15:12:42 CST 2007

On Donnerstag 20 Dezember 2007, Christopher Barker wrote:
> > In [9]: print where( (logical_or(a<1, b<3)), b,c)
> > [4 2 2 1]
> > (Think of the Zen.)
> I'm not sure the Zen answers this one for us.

As you have guessed correctly, I was thinking of "explicit is better than 

> It's really a matter of taste, and many of us prefer infix notation for this
> kind of thing.

You're right, "where( ( (a<1) | (b<3) ), b,c)" *does* look better.
I should have written "for completeness, I want to mention that logical or is 
called logical_or in numpy", and for boolean array, "|" seems to be "the 
correct way".

Ciao, /  /                                                    .o.
     /--/                                                     ..o
    /  / ANS                                                  ooo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20071220/36bc9ae1/attachment.bin 

More information about the Numpy-discussion mailing list