Oh, I see, I thought he wanted to override the original logical operators.

I don't like adding more operators just to make symbolic equation
generation simpler.  I think keeping the language simple and using the
"numpy.logical_and" function is better than making the language more
complicated for a small fraction of users.

There will always be a gap between Python and symbolic equation generation.

On Mon, Aug 6, 2018 at 9:03 PM Steven D'Aprano <st...@pearwood.info> wrote:

> On Mon, Aug 06, 2018 at 02:44:24PM -0700, Neil Girdhar wrote:
>
> > This doesn't work because the logical Boolean operators short circuit in
> > Python.  So you could not even define these operators for the regular
> > Python types.
>
> Todd is not proposing to add dunder methods for the existing "or" and
> "and" operators.
>
> Todd is proposing four new operators spelled "bAND", "bOR", "bXOR" and
> "bNOT", which aren't short-circuiting and call dunder methods, just like
> other operators including "in".
>
> You seem to be saying that "this" (defining new operators that call
> dunder methods) doesn't work because a set of *completely different*
> existing operators short-circuit. If that's not what you meant, I
> don't understand what you actually did mean.
>
>
> > Your two examples numpy and SQLAlchemy don't want this
> > short-circuiting behavior, so you would never want to write anything like
> >
> > (some_array or some_other_array)
> >
> > The reader of this code might imagine that there is some short
> circuiting
> > or conversion to Boolean.
>
> Fortunately Todd isn't proposing that.
>
>
> --
> Steve
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "python-ideas" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/python-ideas/LgwmlPp6YqM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> python-ideas+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
_______________________________________________
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