Quick answer: if not tests whether an expression is falsy. Use it when all falsy values belong to the same branch; use is None, an explicit comparison, or a length check when zero, empty, None, and False have different meanings.

if not in Python runs a branch when a condition is false in a boolean context. It is commonly used for empty lists, empty strings, None, failed checks, and membership tests such as if name not in allowed. if not checks truthiness, whereas not in Python: Operators Explained tests membership and explains the difference between not in and a negated equality chain.
The official Python truth value testing documentation defines which objects count as true or false. The boolean operations reference explains not, and, and or.
The main benefit of if not is readability. Instead of writing if len(items) == 0, you can write if not items. Python checks whether the object is truthy or falsy and chooses the branch accordingly.
Use it when the meaning is clear from the object type and name. For example, if not errors reads naturally when an empty error list means success. When a distinction matters between None, 0, and an empty string, use an explicit comparison. For string-specific checks, Check for an Empty String in Python distinguishes an empty value from whitespace-only text and from None.
Common falsy values include False, None, numeric zero, empty strings, and empty containers. Most other objects are truthy unless their class defines custom truth behavior. That broad rule is convenient, but it is also why the surrounding name matters. if not users is clear; if not result may need more context.
Check For An Empty List
Empty containers are falsy. A non-empty list is truthy, even if the items inside are false-like values.
errors = []
if not errors:
print("no errors")
else:
print("found errors")
This is the idiomatic way to check whether a list has no items. It works for lists, tuples, sets, dictionaries, and many other containers.
Use if not items when the empty-container rule is exactly what you mean. If you specifically need to check length for a custom object, use the rule that object documents.
For dictionaries, the same pattern checks whether there are no keys. For sets, it checks whether there are no members. The syntax stays the same, which helps keep guard clauses short.
Check For An Empty String
An empty string is falsy. A string containing spaces is truthy because it still has characters.
name = ""
if not name:
print("name is missing")
text = " "
if text:
print("spaces still count as text")
If whitespace-only input should count as missing, strip it first with text.strip() and then check the result.
This is common for form fields, command-line prompts, and small configuration values where an empty string means no answer was provided.
Do not strip automatically if spaces are meaningful. Some formats, passwords, and fixed-width text fields treat spaces as real data, so the input rule should decide the cleanup.

Check For None Explicitly
None is falsy, but it is often better to check it with is None or is not None. That avoids mixing up None with valid false-like values such as 0.
timeout = 0
if timeout is None:
print("use default timeout")
else:
print("timeout was provided")
Here 0 may be a meaningful setting. A broad if not timeout check would treat 0 like missing data, which could be wrong.
Use if not value for general truth checks. Use is None when the missing marker specifically matters.
Negate A Boolean Result
not flips a boolean result. It is useful when a helper function returns True for a condition and you need the opposite branch. For cases where the Boolean value itself must be inverted, How to Negate a Boolean in Python covers not, comparisons, truthiness, NumPy masks, and common precedence mistakes.
def is_ready(status):
return status == "ready"
status = "pending"
if not is_ready(status):
print("wait")
This reads well because the function name is positive. Avoid double negatives such as if not is_not_ready(status); they are harder to review.
When possible, name functions so the not version still reads like normal English.
Use not in For Membership Checks
not in checks whether a value is absent from a container. It is different syntax from if not, but it appears in the same kind of conditional code.
allowed = {"admin", "editor"}
role = "guest"
if role not in allowed:
print("access denied")
This is clearer than writing if not role in allowed. Python supports not in directly, so use the direct form.
Membership checks work with strings, lists, sets, dictionaries, and many custom containers. Sets are usually best when checking many values repeatedly.

Combine Checks Carefully
When combining not with and or or, use parentheses if the expression might be misread.
items = []
force = False
if not items and not force:
print("nothing to process")
if not (items or force):
print("also nothing to process")
Both conditions are true in this example. The second version groups the intent explicitly: neither items nor force is present.
The practical rule is simple: use if not value when false, empty, or missing should take the branch. Use explicit comparisons when 0, False, empty strings, and None need different treatment.
Good tests should include a truthy value, an empty value, None, and any false-like value that is still valid for your program. That keeps short boolean code from hiding important edge cases.
When reviewing code, read if not value as “if this value is falsy.” If that sentence is too vague for the business rule, replace the condition with a more explicit comparison or a helper function with a clearer name.
Know Truthiness
False, None, zero, empty strings, empty collections, and custom objects with false __bool__ or __len__ are common falsy values. The expression’s type can define this behavior.

Distinguish None
if value is None checks one sentinel. if not value also matches an empty string, zero, empty list, and other falsy values, so the broader test may reject valid data.
Write Guard Clauses
Validate required state early, return or raise for invalid input, and keep the normal path less nested. A guard should express the contract rather than merely shorten code.
Avoid Ambiguous Defaults
A default value of zero or an empty collection may be valid. Choose a sentinel, explicit flag, or schema when absence must be distinguished from an actual falsy value.

Consider Custom Objects
Custom classes can define __bool__ or __len__, and NumPy arrays can reject ambiguous truth-value testing. Use the API’s documented predicate when a plain truthiness check is not valid.
Test Every Falsy Case
Test None, False, zero, empty text, empty collections, valid non-empty values, custom objects, and array-like inputs when the condition is part of a public function.
Use the official Python truth-value testing documentation. Related Python Pool references include tests and default mappings.
For related condition design, compare truthiness tests, default values, and empty sequences before writing an if not guard.
Frequently Asked Questions
What does if not mean in Python?
if not evaluates the truthiness of an expression and enters the branch when the expression is falsy.
Which values are falsy in Python?
False, None, numeric zero, empty strings, empty collections, and objects whose __bool__ or __len__ returns false are common falsy values.
Should I use if not value to check None?
Use value is None when only None is missing; if not value also treats zero, an empty string, and empty collections as false.
How do I write a clear guard clause?
Choose the condition that matches the contract, return or raise early for invalid state, and avoid hiding meaningful distinctions behind a broad truthiness check.