Hacker News new | past | comments | ask | show | jobs | submit login

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 [1]: https://fastapi.tiangolo.com [2]: https://mypy.readthedocs.io/en/stable/protocols.html




The 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).




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: