On Mon, 10 Oct 2016 10:56 am, Ian Kelly wrote: > On Oct 9, 2016 2:57 PM, <breamore...@gmail.com> alleged:
> The Pythonic way > > if b >= a <= c: > ... I doubt that would be considered Pythonic by many people. Chained comparisons are Pythonic, but not legal but weird combinations like `a == b < c is not d >= e <= f`. > Better: > > if a <= b <= c: > ... That's more like it. Unfortunately it doesn't mean the same as Mark's version: b >= a <= c means b >= a and a <= c which is True for a = 1, b = 3 and c = 2; a <= b <= c means a <= b and b <= c which is False for a = 1, b = 3 and c = 2. > Using consistent operators is not required but is easier to read and less > confusing. Indeed. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list