|
|
|
|
|
by tony
1396 days ago
|
|
I haven't used pydantic yet. I'm conservative when adding (non-dev) dependencies since I am maintaining library packages. For other projects, it's a possibility. > if I mark a field as an int, and pass in a str, I want an error -- is that weird of me That is perfectly fine. And the question is why don't TypedDict, NamedTuple, dataclass raise during construction - since if they don't - we have to play it safe and do isinstance checking since we can't trust the field's types at runtime. I suppose the idea the `typing` module [1] is to be unobtrusive: not to be involved in runtime checks. What I want is something that does what pydantic does in standard library. I think it's a sensible request and would be indispensable for anyone wrangling data. [1] https://docs.python.org/3/library/typing.html |
|