- Published on
Does None Exist in Python?
- Authors

- Name
- Ina Lee
Does None exist or not?
When I started using Python, I considered None as null. null in Java or C means there is absolutely nothing, and using it in the wrong way can crash your program -- like segmentation fault errors in C or null pointer exceptions in Java. However, None is something in Python. So what is it? Does None exists or not?
What is None in Python?
None is a special built-in constant in Python that represents the absence of a value. It is the only instance of the NoneType.
print(type(None)) # <class 'NoneType'>
It if often used to signal that something is missing, not initialized, or intentionally left blank.
Why does "nothing" need to exist?
Python is fully objected-oriented -- everything is an object, from numbers and strings to functions and even modules. If you call a function and it doesn't return anything, Python still returns something.
def do_nothing():
pass
result = do_nothing()
print(result) # None
This design lets Python treat "no result" consistently. It avoids special exceptions or errors for missing values. Instead, it gives us a reliable way to say "this has no value right now" by using None.
How's it different from null in C and Java?
In C, NULL is often just an integer zero used in pointer context. In Java, null is a literal that means the reference points to no object at all. In both languages, accidentally using a null reference can cause major runtime errors. Pythong avoids this by treating None as a real object.
a = None
print(a == None) # True
print(a is None) # True
Because None is a singleton, we often compare it using is, which is both fast and safe.
Common use cases of None
1. Function return values
Functions that don't explicitly return anything still return None.
def greet():
print("Hello")
x = greet() # x is None
2. Default arguments
Mutable default arguments can lead to bugs. None is used to avoid this.
def add_item(item, container=None):
if container is None:
container = []
container.append(item)
return container
3. Tree and graph traversal
In recursive structures like trees,
if node.left is None:
return
This checks whether a left child exists, Without None, we'd have to invent other special cases.
None, [], "", 0 — what’s the difference?
They are all falsy, but different obejcts.
| Expression | Type | Truthy? |
|---|---|---|
None | NoneType | False |
[] | list | False |
"" | str | False |
0 | int | False |
False | bool | False |
Only None means "no value". The rest are valid objects with defined meanings.
Tree example: Does a node exist or not?
In a binary tree, if node.left is None means the left child exists but is explicitly empty. It’s a useful distinction: the attribute exists, but holds no subtree.
# This node has a left child, but it's None.
class TreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
Can true emptiness exist in Python?
No. Even None is an object. Python never truly has “nothing” in memory, it just uses special objects to represent emptiness in a structured, safe way.
Conclusion: None doesn't exist, but it does.
None represents absence, but it exists as an object. This design gives Python the power to handle missing values in a clean, object-oriented way. Like the wind, None is invisible, but it’s definitely there.