# None is a singleton
a = None
b = Noneprint(f"a is b: {a is b}")
print(f"id(a) == id(b): {id(a) == id(b)}")
# NoneType can't be instantiatedprint(f"type(None): {type(None)}")
# None in containers
values = [1, None, "hello", None, 3]
non_none = [v for v in values if v isnotNone]
print(f"Filtered: {non_none}")
# None is falsy but not equal to other falsy valuesprint(f"None == False: {None == False}")
print(f"None == 0: {None == 0}")
print(f"None == '': {None == ''}")
Output
Click "Run" to execute your code
None is a singleton — there is only ever one None object in memory. It is falsy but not equal to other falsy values like 0, False, or ''.
Challenge
Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?