[SciPy-Dev] Official alias for logical_not?

Joscha Schmiedt joscha.schmiedt@googlemail....
Fri Sep 9 04:13:35 CDT 2011


Hm, I see I should have read the documentation more carefully and noticed:

"If you know you have boolean arguments, you can get away with using Numpy's
bitwise operators, but be careful with parentheses, like this: z = (x > 1) &
(x < 2). The absence of Numpy operator forms of logical_and and logical_or
is an unfortunate consequence of Python's design."  on
http://www.scipy.org/NumPy_for_Matlab_Users#logicalNotes

So, the solution to my problems were parenthese. Thank you for the hint and
not saying RTFM :-)

2011/9/9 Pauli Virtanen <pav@iki.fi>

> Fri, 09 Sep 2011 09:21:14 +0100, Joscha Schmiedt wrote:
> [clip]
> > expressions compared to ~, & and xor in Matlab. Therefore, I regularly
> > find myself creating aliases as n_ for them, which is basically fine,
> > but I could imagine other people doing so.
> >
> > So, are there any plans for officially creating shorthand aliases for
> > the logical_ functions?
>
> For boolean arrays, ~, &, ^ et al. are the logical operations.
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20110909/78bb59cf/attachment.html 


More information about the SciPy-Dev mailing list