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

Jelte Fennema me at jeltef.nl
Mon Nov 23 20:11:47 EST 2015


On 24 November 2015 at 01:26, Bruce Leban <bruce at leban.us> wrote:

> If this idea were to fly, a better name would be something that doesn't
> have that problem, e.g., .and. .or. .not. I don't want to bikeshed the
> exact syntax**, but I think it should be clear that with something like
> this: (1) no one is going to accidentally type them and (2) they are pretty
> clearly some variation of the standard and/or/not.


I think a naming scheme like that is indeed a good way to solve the
confusion issues, since it is also immediately clear that these would be a
special version of the normal operators. Another advantage is that it could
also be extended to the in operator, if that one is to be included.

I'm not sure I like the dots version very much though, but like you said
there are lots of syntax error options to choose from.

On 24 November 2015 at 01:26, Bruce Leban <bruce at leban.us> wrote:

>
> On Mon, Nov 23, 2015 at 4:08 PM, Chris Angelico <rosuav at gmail.com> wrote:
>
>> I think it's reasonable, except for the potential confusion of having
>> *three* "and" operators.
>>
>
> I think using && and || would be an attractive nuisance for people
> switching from another programming language. Right now if I accidentally
> right && in Python or "and" in another language, I get an immediate syntax
> error. With this proposal, I get unexpected results.
>
> If this idea were to fly, a better name would be something that doesn't
> have that problem, e.g., .and. .or. .not. I don't want to bikeshed the
> exact syntax**, but I think it should be clear that with something like
> this: (1) no one is going to accidentally type them and (2) they are pretty
> clearly some variation of the standard and/or/not.
>
> **Lots of other possibilities that are syntax errors right now: @and, (and),
> etc. I like .and. because it's less visual clutter and it's easy to type.
>
> --- Bruce
> Check out my puzzle book and get it free here:
> http://J.mp/ingToConclusionsFree (available on iOS)
>
>
> --
>
> ---
> 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.
>
> _______________________________________________
> 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/cbcc9bf7/attachment-0001.html>


More information about the Python-ideas mailing list