Kyle Stanley wrote: > I agree, that syntax definitely seems counter-intuitive. If it came up in > a code review, I would request a revision to "A in B and B < C". >
Please recall that chained comparisons such are >>> A < B < C is to produce simple code when B is not an identifier, but an expression. For example >>> low < len(x) < high or >>> inner ** 2 < x**2 + y**2 + z**2 < outer**2 which determines if (x, y, z) is in a spherical shell. Even for "A < B < C" it might be better to have "A < B and B < C". Particularly if B and C are complicated expressions. -- Jonathan
_______________________________________________ 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/737OEOYCOLU26QJNVCBSJ7IKDCGROB5W/ Code of Conduct: http://python.org/psf/codeofconduct/