On Sat, Aug 4, 2018 at 9:13 AM, Steven D'Aprano <st...@pearwood.info> wrote:

> On Fri, Aug 03, 2018 at 03:17:42PM -0400, Todd wrote:
>
> > Boolean operators like the sort I am discussing have been a standard part
> > of programming languages since forever.  In fact, they are the basic
> > operations on which modern microprocessors are built.
> >
> > The fact that Python, strictly speaking, doesn't have them is extremely
> > unusual for a programming language.
>
> I'm rather surprised at this claim.
>
> Can you give a survey of such overridable boolean operators which are
> available on modern microprocessors?
>
> What programming languages already have them? When you say "forever",
> are you going back to Fortran in the 1950s?
>

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.


> > In many cases they aren't necessary in
> > Python since Python's logical operators do the job well enough, but there
> > are a set of highly diverse and highly prominent cases where those
> logical
> > operators won't work.
>
> Can you list some of these diverse and highly prominent use-cases?
>
> I can think of two:
>
> - elementwise boolean operators, such as in numpy;
>
> - SQL-like DSL languages;
>
> plus a third rather specialised and obscure use-case:
>
> - implementing non-binary logical operators, for (e.g. ternary
>   or fuzzy logic).
>

Also symbolic mathematics like in sympy.  That is three.


> > There are workarounds, but they are less than
> > optimal for the reasons I describe, and the previous discussion I linked
> to
> > goes into much more detail why these new operators are important.
>
> There are certainly advantages to using binary operators over named
> functions, and a shortage of good, ASCII punctuation suitable for new
> operators.
>
> I don't think much of your names bOR etc.
>
> I think that before adding more ad hoc binary operators, we ought to
> consider the possibility of custom operators.


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.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to