Use value is None (or value is not None) to check whether a value is Python’s None singleton. value == None performs an equality comparison instead, and a value’s type can customize that comparison. For a singleton check, Python’s guidance is to use identity, not equality.
What is the difference between is None and == None?
| Expression | What it asks | Can a type customize the result? | Use it for |
|---|---|---|---|
x is None |
Is x the one None object? |
No. Identity operators cannot be customized. | Checking whether a value is None. |
x == None |
Does x compare equal to None? |
Yes. The type can define equality behavior. | Equality comparisons in general; it is not the recommended None check. |
Python has a single None object, so a value assigned None is identical to it. The Python 3.14.7 expression reference says that PEP 8 advises comparisons for singletons should use is or is not, never equality operators.
Why can == None behave differently?
The == operator performs equality comparison. Python maps x == y to the rich comparison method x.__eq__(y), which a class can customize. That method may even return a value other than True or False; when the result is used as a condition, Python converts it to a Boolean.
For example, a class can define equality so that one of its instances compares equal to None, even though the instance is not the None object. By contrast, is asks only whether both references point to the same object. The Python data model documentation describes rich comparisons and __eq__; the default object.__eq__ behavior uses identity when a class has not supplied its own equality method.
#1 Best Overall
How should you check for None?
Check whether a result is missing
result = lookup(key)
if result is None:
handle_missing_result()
This condition tests exactly whether result is the None singleton.
Check whether a value is present
if value is not None:
use(value)
Use is not None for the inverse check. It is still an identity test, not a general test of whether the value is useful or non-empty.
Rank #2
Why not use if not value?
if not value checks truthiness, not whether a value is None. It also treats values such as 0, '', and empty containers as false. If those are valid values and only None means “absent,” use an explicit identity check so the condition does not reject them.
When should you use == or is?
Use == to compare values, such as strings, integers, or ordinary containers. Use is when the question is whether two references identify the same object—especially for None. Object identity is not generally guaranteed to correspond to value equality, so is is not a substitute for == on ordinary data.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →The same singleton-checking principle applies to other singleton sentinels such as NotImplemented, as noted in the Python expression reference. The Python Programming FAQ likewise explains that two variables assigned None are guaranteed to be identical because None is a singleton.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




