4 ms·
I like python but I would never choose it for anything more than trivial on the backend. I want to know what types are being passed around from one middleware f
by janalsncm 3y ago
I like python but I would never choose it for anything more than trivial on the backend. I want to know what types are being passed around from one middleware function to the next. Yes python has annotations but that’s not enough.
- acdha 3y agoJust wait until you see what the enterprise Java developers passing around with type Object and encoded XML blobs. Type checking is really useful but it can be defeated in any language if you don’t have a healthy technical culture.
- Sohcahtoa82 3y agoIs that why I see much object serialization/deserialization in Java? They're trying to pass data between layers of middleware, but Java has very strict typing, and the middleware doesn't know what kind of object it will get, so it has to do tons of type introspection and reflection to do anything with the data?
- acdha 3y agoThere are multiple causes but a lot of the nastiest code I’ve seen did suggest “I don’t have time to update those other layers”, along with the very common misperception that you’re working on a huge shared service for the ages and need everything to be as generic and customizable as possible.
- eternityforest 3y agoI wish Python would have native JSON schema support to stop this issue. There's https://pypi.org/project/jsonschema-typed-v2/ https://pypi.org/project/jsonschema-typed-v2/ but it hasn't been updated in a few years.
- silviogutierrez 3y agoWhat about https://quicktype.io https://quicktype.io ?
- eternityforest 3y agoo.O wat? That's awesome!
- eternityforest 3y agoType annotations are pretty good. I'd like to see a strict mode though, something you import that makes missing annotations anywhere into a fatal error
- robben1234 3y agoHave you looked into Mypy with the strict flag? https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-strict https://mypy.readthedocs.io/en/stable/command_line.html#cmdo...