On Mon, Mar 18, 2019 at 3:42 PM Greg Ewing
Tim Delaney wrote:
I would argue the opposite - the use of "is" shows a clear knowledge that True and False are each a singleton and the author explicitly intended to use them that way.
I don't think you can infer that. It could equally well be someone who's *not* familiar with Python truth rules and really just meant "if x". Or someone who's unfamiliar with booleans in general and thinks that every "if" statement has to have a comparison in it.
Regardless of whether it's idiomatic Python code or not, this pattern ("is True:") can be found all over Python code in the wild. If CPython ever broke this guarantee, quite a few popular libraries on pypi would be broken, including pandas, sqlalchemy, attrs and even Python's own standard library: https://github.com/python/cpython/blob/c183444f7e2640b054956474d71aae6e8d31a...