[Python-ideas] [Python-ideos] Dedicated overloadable boolean operators
Chris Barker
chris.barker at noaa.gov
Mon Nov 23 21:38:28 EST 2015
On Mon, Nov 23, 2015 at 5:44 PM, Michael Selik <mike at selik.org> wrote:
> With NumPy I make that mistake constantly:
> A == a & B == b
> rather than
> (A == a) & (B == b)
>
> I'd put that in the category of parentheses tax
>
It's not just the operator precedence that's an issue here -- this also
means something different than what people expect. As it happens a bitwise
and works "just like" and when the values are boolean (like above), but
that isn't always the case -- confusion waiting to happen.
-CHB
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151123/3988933a/attachment.html>
More information about the Python-ideas
mailing list