PEP8 states that checks for None
should be performed using is None
. The same holds true for singletons in general. But PEP8 also states, that equality to True and False should not be performed using an operator, is
being even worse than ==
:
Yes: if greeting:
No: if greeting == True:
Worse: if greeting is True:
I understand that the first one is the prettiest and most pythonic way, but sometimes i find myself in a situation where i want to explicitly show that i am comparing against True
or False
. How is is
worse than ==
in that situation?