PHP calls variables with no value NULL. Variables are NULL if they are manually assigned as such, their value has never been set to anything before, or they are unset via the unset() method.
Python calls variables with no value None.
Variables can be unset via the unset() method and will become NULL.
Variables can be checked against null via the is_null() method.
In Python, None is actually an object, and behaves like one. Under the hood, None is of type NoneType. Variables can be checked against None programmatically just like any other object comparison:
class myClass:
def __init__(self, foo, bar):
self.foo = foo
self.bar = bar
a = myClass("apples", "oranges")
b = None
print("a is not None") if (a is not None) else print("a is None")
print("b is not None") if (b is not None) else print("b is None")Will yield:
a is not None
b is None