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

Bruce Leban bruce at leban.us
Mon Nov 23 19:26:18 EST 2015


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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151123/bd2c799c/attachment.html>


More information about the Python-ideas mailing list