Python None - The ids of all Nones are the same
In Python, None means null or nothing. The function that doesn't have the return statement returns None.
Some Python programmers may substitute None for raising exceptions to check errors in the functions or methods. Others may use None in the if statement. It's important to discuss how or when to use None in the team. Which should we use returning None or raising exceptions?
Anyway, we should know the simple fact that the ids of Python Nones are all equal.
print(None) # None print(id(None)) # 4477566016 s = [1, 2] x = s.append(3) print(x) # None print(id(x)) # 4477566016
The append() returns None and it is exactly equal to the None. The id() returns the object's memory address so all Nones are the same object.