Use if not t: to check whether a Python tuple is empty. For example:
if not my_tuple:
print("The tuple is empty")
Python treats an empty tuple as false in a Boolean test, so this branch runs when the tuple has no items. Python’s built-in types documentation describes this truth-value behavior.
Check a tuple with a truth test
For a tuple named t, write if not t: when the empty case should run, or if t: when the non-empty case should run:
t = ()
if not t:
print("Empty")
else:
print("Not empty")
This works because empty sequences are false in a Boolean context. The same rule applies to other empty sequence types, but a truth test does not establish that a value is specifically a tuple.
#1 Best Overall
Use len(t) == 0 for an explicit count check
You can also write if len(t) == 0:. Both this and if not t: check whether a tuple has no items. Prefer the truth test for a concise branch; choose the length comparison when spelling out the zero-item condition makes the surrounding code clearer. The cited documentation establishes the truth-test behavior, but not a performance winner between the two forms.
Recognize empty and one-item tuples
The empty tuple can be written as () or created by calling tuple() with no argument. A one-item tuple requires a trailing comma: (item,). Parentheses alone do not turn a single value into a tuple, as explained in the Python tutorial on data structures.
Rank #2
empty = ()
also_empty = tuple()
one_item = (None,)
print(not empty) # True
print(not also_empty) # True
print(not one_item) # False
(None,) is not empty: it contains one item, even though that item is None.
Decide what to do with None or other input types
If a value may be None or a type other than tuple, first decide what your function accepts and validate that contract if needed. A truth test returns true for any falsy value, not only an empty tuple. For example, None also makes if not value: run, so that check alone cannot distinguish it from an empty tuple.
Annotate an empty tuple when describing types
In the Python typing specification, tuple[()] denotes the type of an empty tuple. It describes the expected type for static typing; it does not replace a runtime emptiness check such as if not t:. See the typing specification for tuples.
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.




