Created
May 31, 2025 00:01
-
-
Save mschulz/0be93c1da64831ed6fba46817d12dcc5 to your computer and use it in GitHub Desktop.
Use a sentinel for a missing value, not None
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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