None (Null Value)
PY · Variables & Typessyntax
variable = Noneexample
result = None
if result is None:
print("No result yet")
# Common pattern: optional return
def find_user(user_id: int) -> str | None:
return Noneoutput
No result yetNote Always compare to None with 'is' or 'is not', never == or !=. None is a singleton object.