Neil Girdhar wrote: > Some people find this legal syntax confusing: > A in B < C > (It means A in B and B < C.) > I feel like most code reviews would not allow this kind of code to be > checked in, at least without a comment explaining what the code does. What > are the motivating reasons for allowing this syntax? Is there any > idiomatic code that uses it? > 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.
FWIW, I totally agree. Expressions like that are extremely confusing, and it is surprising that they are valid. Real-wold usage of those is more likely to be accidental than purposeful, so it would be better if they were disallowed and treated as syntax errors. -- Steve J. _______________________________________________ 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/GV6BKGW4MRNCKEVL7R75JFD7KRALNJRH/ Code of Conduct: http://python.org/psf/codeofconduct/