logoalt Hacker News

woodruffw • yesterday at 9:06 PM • 1 reply • view on HN

Python’s type system has union types (including Option), and using them is pretty ergonomic. As TFA points out the problem is that `None` gets contextually reused in all kinds of places where a proper sentinel type is more appropriate.


Replies

aw1621107 • yesterday at 9:23 PM

Pretty sure Python's union types don't nest, though. If you could nest optionals then I feel that reduces the need for separate sentinel types since e.g., you can distinguish between "value not present" (None) and "null value present" (Some(None))

➕ show 2 replies