Skip to content

Instantly share code, notes, and snippets.

@mschulz
Created May 31, 2025 00:01
Show Gist options
  • Save mschulz/0be93c1da64831ed6fba46817d12dcc5 to your computer and use it in GitHub Desktop.
Save mschulz/0be93c1da64831ed6fba46817d12dcc5 to your computer and use it in GitHub Desktop.
Use a sentinel for a missing value, not None
class Sentinel:
def __init__(self, name):
self.name = name
def __repr__(self):
return f"<{self.name}>"
MISSING = Sentinel("MISSING")
UNSET = Sentinel("UNSET")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment