Inspectopedia Help

Using equality operators to compare with None

Reports comparisons with None. That type of comparisons should always be done with is or is not, never the equality operators.


a = 2 if a == None: print("Success")

Once the quick-fix is applied, the code changes to:

a = 2 if a is None: print("Success")

Inspection Details

Available in:

DataSpell 2023.3, PyCharm 2023.3


Python Community Edition, 233.SNAPSHOT

Last modified: 13 July 2023