[Python-ideas] [Python-ideos] Dedicated overloadable boolean operators
Brendan Barnwell
brenbarn at brenbarn.net
Fri Nov 27 14:43:14 EST 2015
On 2015-11-27 09:28, Andrew Barnert via Python-ideas wrote:
> And finally, NumPy is one of the uses that doesn't require short
> circuiting, and the same is almost certainly true for other
> elementwise uses, and yet we seem to all be agreed that the new
> overload has to be short-circuitable.
Do we? I don't. I agree that if we add a way to overload the existing
and/or to support these new usages, then that has to be
short-circuitable. because and/or currently are short-circuitable and we
can't get rid of that. But to me one of the attractive aspects of this
new proposal is that the new operators need not be short-circuitable,
which would avoid the various contortions required in a scheme like PEP
335 and thus greatly simplify the overloading. In other words the whole
point of these new operators would be to do and-like and/or or-like
operations that definitely do want both of their arguments all the time
(such as elementwise operations or combining abstract query objects like
in these SQL cases).
--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no
path, and leave a trail."
--author unknown
More information about the Python-ideas
mailing list