
Jan. 5, 2021
8:36 a.m.
3) One more suggestion: class MyThing(TypedDict, optional_types_may_be_missing=True): req1: int opt1: Optional[str] This would allow `Optional` fields to be also missing. It would not work when you want a field, that can be missing, but if present, is not allowed to have `None` as value. I would expect that to be rare (but still a requirement for some). Obviously a better name would be needed for the parameter. Maybe `allow_missing`, `missing`, `strict=False` etc.