<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 4, 2018 at 9:13 AM, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Aug 03, 2018 at 03:17:42PM -0400, Todd wrote:<br>
<br>
> Boolean operators like the sort I am discussing have been a standard part<br>
> of programming languages since forever. In fact, they are the basic<br>
> operations on which modern microprocessors are built.<br>
> <br>
> The fact that Python, strictly speaking, doesn't have them is extremely<br>
> unusual for a programming language.<br>
<br>
</span>I'm rather surprised at this claim.<br>
<br>
Can you give a survey of such overridable boolean operators which are <br>
available on modern microprocessors?<br>
<br>
What programming languages already have them? When you say "forever", <br>
are you going back to Fortran in the 1950s?<span class=""><br></span></blockquote><div><br></div><div>Sorry I wasn't clear, I didn't mean overloadable boolean operators are standard, but rather boolean operators in general. I was trying to point out that there is nothing domain-specific about boolean operators. <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> In many cases they aren't necessary in<br>
> Python since Python's logical operators do the job well enough, but there<br>
> are a set of highly diverse and highly prominent cases where those logical<br>
> operators won't work.<br>
<br>
</span>Can you list some of these diverse and highly prominent use-cases?<br>
<br>
I can think of two:<br>
<br>
- elementwise boolean operators, such as in numpy;<br>
<br>
- SQL-like DSL languages;<br>
<br>
plus a third rather specialised and obscure use-case:<br>
<br>
- implementing non-binary logical operators, for (e.g. ternary<br>
or fuzzy logic).<span class=""><br></span></blockquote><div><br></div><div>Also symbolic mathematics like in sympy. That is three.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> There are workarounds, but they are less than<br>
> optimal for the reasons I describe, and the previous discussion I linked to<br>
> goes into much more detail why these new operators are important.<br>
<br>
</span>There are certainly advantages to using binary operators over named <br>
functions, and a shortage of good, ASCII punctuation suitable for new <br>
operators.<br>
<br>
I don't think much of your names bOR etc.<br>
<br>
I think that before adding more ad hoc binary operators, we ought to <br>
consider the possibility of custom operators.</blockquote><div><br></div><div>I am personally very strongly against custom operators. I just have
visions of someone not liking how addition works for some particular
class and deciding implementing a "+" operator would be a great idea.</div></div></div></div>