4 ms·
Pydantic typing differs from mypy typing. Optional[T] means something different under the two. I designed typedload before pydantic was a thing and I made it w
by LtWorf 4y ago
Pydantic typing differs from mypy typing. Optional[T] means something different under the two.
I designed typedload before pydantic was a thing and I made it with mypy in mind already, and with the idea of using the standard library, not defining my own dataclass.
Unfortunately mypy has a limitation so you can't make a function that takes Type[T] and returns T. You can define it but it won't work for all types. There is still discussion on how to provide this feature.
- BiteCode_dev 4y agoYeah this ones is really annoying with default values.