[Python-ideas] [Python-ideos] Dedicated overloadable boolean operators

Michael Selik mike at selik.org
Tue Nov 24 05:36:42 EST 2015


On Tue, Nov 24, 2015 at 5:00 AM Jelte Fennema <me at jeltef.nl> wrote:

> On 24 November 2015 at 10:14, Michael Selik <mike at selik.org> wrote:
>
>> As I think of people's reactions to seeing & and | for the first time,
>> the typical response is, "What do you mean by bitwise?" Not, "Why are you
>> using bitwise operators for non-bitwise operations?" Interestingly, no one
>> in this thread seems to have a problem with ``&`` and ``|`` for set
>> intersection and union. The primary complaint is that NumPy users
>> instinctively reach for ``and``/``or`` and then forget the operator
>> precedence of ``&``/``|``.
>>
>

> I get your points that it is bad to confuse people with even more and/or
> operators they have to learn. But I think it's weird that you are saying
> that people accept the wrong operator precedence readily, even though
> before you said you do it wrong yourself constantly.
>

I make that mistake in an interactive environment and fix it moments later,
so it's not a big thing for me. I also occasionally forget to put a colon
at the end of my for-loops, etc. ;-)


> This is also why I think the set intersection and union are not a problem
> is because the operator precedence is correct there.
>
> Your point that the problem is mostly that the old code will still be usin
> the ``&`` operator, which could confuse people is true. But I also think
> that would eventually disappear, which would make Python better in the
> future.
>

What's the half-life of deprecated code? That stuff is like nuclear waste.
Or more like a bacteria you're spot-treating with antibiotic. It keeps
replicating while you apply ointment and might evolve a resistance. Ok, ok,
I'm getting a little too colorful there.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151124/e3f9a462/attachment.html>


More information about the Python-ideas mailing list