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

Jelte Fennema me at jeltef.nl
Mon Nov 23 19:17:58 EST 2015


This confusion could quite simply be solved by just not implementing the
operations on the standard types, even though they would be trivial to
implement. This just leaves the possibility for library developers to do
something useful with the operators, like with the new @ operator.

On 24 November 2015 at 01:13, Guido van Rossum <guido at python.org> wrote:

> 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)
> _______________________________________________
> 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/
>
> --
>
> ---
> 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/5bEW_wwNJcM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> python-ideas+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151124/220d5dbb/attachment.html>


More information about the Python-ideas mailing list