3 ms·
Type hints in Python are IMO great and quite expressive! You can create sum types (a bit verbose but they are there). You can introspect them at run time and
by emptysea 7y ago
Type hints in Python are IMO great and quite expressive!
You can create sum types (a bit verbose but they are there).
You can introspect them at run time and create things like pydantic[0] and fastapi[1].
Strict null checks with Optional[T] are great!
Now I'm not too familiar with Go's type system, but with protocols, Unions, Optional[T] and other generics offered by MyPy[2] I'd wager the type system is __more__ expressive than Go.
[0]: https://pydantic-docs.helpmanual.io https://pydantic-docs.helpmanual.io
[1]: https://fastapi.tiangolo.com https://fastapi.tiangolo.com
[2]: https://mypy.readthedocs.io/en/stable/protocols.html https://mypy.readthedocs.io/en/stable/protocols.html
- weberc2 7y agoThe type system is more expressive, but much clunkier and also it needs to be expressive to accommodate all of the weird things people do in Python (and you still can’t model SQLAlchemy types).