Post

What do you do when you can't use `None` as the default? You can use `object()`... Or a singleton class... Or another workaround... And all these hacks had flaws. That's why Python 3.15 introduced the built-in `sentinel`. You can use it to create placeholder values 👇

There are many benefits to using `sentinel`. One of them is that typing sentinels is much cleaner than typing any of the alternatives. That's because sentinels can be used as their own type. Just like `None` can 👇

No replies yet.