No tools exist to do recursive static type checking like you are showing, correct?
This discussion and a lot Guido’s example makes me think of pydantic. Pydantic to my understanding is a library that you define models which represent external facing web services. You get the json response and it will parse and validate it.
So it seems there’s already 3rd party libraries that do handle these sorts of things. You can define a pydantic model who has an optional field, during parsing if the field isn’t present then the field will be populated with None
.
I’m not sure if the existence of pydantic would be in favor or against this sort of syntax for the examples that Guido gives, which are parsing json response. Clearly there’s similar enough use cases in python as js for parsing json responses but simultaneously there’s 3rd libraries that can easily handle these things in addition to a lot more.