[Python-ideas] [Python-ideos] Dedicated overloadable boolean operators
Random832
random832 at fastmail.com
Tue Nov 24 01:34:20 EST 2015
On 2015-11-24, Chris Angelico <rosuav at gmail.com> wrote:
> I think it's reasonable, except for the potential confusion of having
> *three* "and" operators. The one with the word is never going to
> change - its semantics demand that it not be overridable.
How? Are you referring to the short-circuit? C# allows
overloading the short-circuit operators by doing it in two
parts - in pseudocode:
a and b: a if a.__false__() else a & b
a or b: a if a.__true__() else a | b
There's no fundamental reason short-circuiting "demands" that it
not be overridable, just because C++ can't do it.
More information about the Python-ideas
mailing list