4 ms·
Why do you think python3 is not typesafe?
by adsharma 5y ago
Why do you think python3 is not typesafe?
- packetlost 5y agoBecause it's not? It has a type system but it's still duck-typed at the end of the day, and no amount of Mypy will change that.
- adsharma 5y agoIt should still be possible to use the python syntax and a reimplemented stdlib to build a statically typed, typesafe variant. I think you object to the name python3, because there is a duck typed interpreter that's popular.
- packetlost 5y agoYou fundamentally cannot build a statically typed variant of Python without cutting portions of the stdlib, most notably `mock.patch`. You could do a good majority of it, probably enough to be completely usable, but at what point does it stop being Python? Go use Nim if you want statically typed Python-ish syntax.
- adsharma 5y agopy2many transpiles py3 to nim. Think of python as a way to interpret nim code if you like, with a large installed base of existing libraries. There is demand for iterative creation of software: first get the logic out with the least friction and then think about types, resource leaks, good software engineering practices etc.
- hermitdev 5y agoType safety and static typing are orthogonal. Both C and C++ are statically typed, yet are not type safe, for instance.