<div dir="ltr">Oh, I see, I thought he wanted to override the original logical operators.<div><br></div><div>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.</div><div><br></div><div>There will always be a gap between Python and symbolic equation generation.</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 6, 2018 at 9:03 PM Steven D'Aprano <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Aug 06, 2018 at 02:44:24PM -0700, Neil Girdhar wrote:<br>
<br>
> This doesn't work because the logical Boolean operators short circuit in <br>
> Python. So you could not even define these operators for the regular <br>
> Python types.<br>
<br>
Todd is not proposing to add dunder methods for the existing "or" and <br>
"and" operators.<br>
<br>
Todd is proposing four new operators spelled "bAND", "bOR", "bXOR" and <br>
"bNOT", which aren't short-circuiting and call dunder methods, just like <br>
other operators including "in".<br>
<br>
You seem to be saying that "this" (defining new operators that call <br>
dunder methods) doesn't work because a set of *completely different* <br>
existing operators short-circuit. If that's not what you meant, I <br>
don't understand what you actually did mean.<br>
<br>
<br>
> Your two examples numpy and SQLAlchemy don't want this <br>
> short-circuiting behavior, so you would never want to write anything like<br>
> <br>
> (some_array or some_other_array)<br>
> <br>
> The reader of this code might imagine that there is some short circuiting <br>
> or conversion to Boolean.<br>
<br>
Fortunately Todd isn't proposing that.<br>
<br>
<br>
-- <br>
Steve<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
<br>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Google Groups "python-ideas" group.<br>
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/python-ideas/LgwmlPp6YqM/unsubscribe" rel="noreferrer" target="_blank">https://groups.google.com/d/topic/python-ideas/LgwmlPp6YqM/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href="mailto:python-ideas%2Bunsubscribe@googlegroups.com" target="_blank">python-ideas+unsubscribe@googlegroups.com</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout" rel="noreferrer" target="_blank">https://groups.google.com/d/optout</a>.<br>
</blockquote></div>