[Python-ideas] [Python-ideos] Dedicated overloadable boolean operators

Guido van Rossum guido at python.org
Mon Nov 23 19:13:42 EST 2015


I honestly think the added confusion makes it a non-starter. It's also
confusing that in other languages that have && and ||, they are
shortcut operators, but the proposed operators here won't be. And the
real question isn't "when to use & vs. &&", it's "when to use 'and'
vs. &&".

On Mon, Nov 23, 2015 at 4:08 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Tue, Nov 24, 2015 at 10:49 AM, Jelte Fennema <me at jeltef.nl> wrote:
>> As for the PEP, I have no problem writing one if this is accepted as a
>> useful addition. Also any suggestions and critiques are very welcome of
>> course.
>
> 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. When should
> you use & and when &&? Judging by how @ has gone, I think the answer
> will be simple: "Always use &, unless the docs for some third-party
> library say to use &&", in which case I think it should be okay.
>
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-ideas mailing list