On Sun, Nov 17, 2019 at 7:45 PM Neil Girdhar <mistersh...@gmail.com> wrote:
> If not, I suggest dividing the comparison operators into two groups:
>
> in, not in, is, is not
>
> and
>
> <, >, <=, >=, ==, !=
>
> and then disallowing chaining of operators from both groups.
>
> For example, still allowed:
>
> A <= B <= C
>
> A in B in C
>
> disallowed:
>
> A < B in C
>

And also allowed:

A is B in C
A in B is C

I'm not sure these are any better than the ones you've chosen to disallow :)

If you want to push for these to be disallowed, I would recommend
doing it first in a linter or code quality tool. That's a completely
safe way to try it out, with no language changes at all. Reject them
automatically in code review, or even as a pre-commit/pre-push hook
(or equivalent in your own source control system). If it's done at the
syntactic level, there's absolutely no recourse, and any code anywhere
that uses these chained comparisons will be suddenly broken.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/UBQO6AD4PSB3FS42EZKNVC5IUQ3QGDN6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to