|
|
|
|
|
by diarrhea
297 days ago
|
|
Yes, Python is massively ahead there. The largest wart is that types can be out of sync with actual implementation, with things blowing up at runtime -- but so can Go with `any` and reflection. Python, for a number of years at this point, has had structural (!) pattern matching with unpacking, type-checking baked in, with exhaustiveness checking (depending on the type checker you use). And all that works at "type-check time". It can also facilitate type-state programming through class methods. Libraries like Pydantic are fantastic in their combination of ergonomics and type safety. The prime missing piece is sum types, which need language-level support to work well. Go is simplistic in comparison. |
|