3 comments
When I was writing a bunch of Lua, I was a big fan of having a None sentinel value (Lua uses 'nil' for representing absence) and it was useful for a lot of things similar to Pydantic's MISSING.<p>This distinction is something that I think is actually handy about JavaScript, and distinguishing between 'null' and 'undefined' is sometimes useful for similar reasons.
"A simple cache returns None both for a missing key and for a key that maps to None."<p>No, it returns KeyError. Or at least it should.
I like it. I can't see how to do better while remaining compatible with Python idioms.