4 ms·
As someone maintaining a hugely complex system in Python: type hints make it bearable, but not good. A strongly typed, verbose language is an absolute, fucking,
by packetlost 4y ago
As someone maintaining a hugely complex system in Python: type hints make it bearable, but not good. A strongly typed, verbose language is an absolute, fucking, *must* for all but the simplest of systems. You can make it work if you're building web services where the type contract is in the web/RPC API (and hopefully strongly enforced), but for basically anything else, use something with a good type system. I cannot stress enough how important it is for scaling complexity.
If you must use Python, turn on mypy with the `--strict` flag, and do it early in your project's lifecycle. Do NOT make exceptions or allow for "gradual" typing, it's monumentally more difficult to add typing after the fact than early on. Type hint as much as you can, including tests. Pytest's fixtures can be type hinted both at the `def` and with their results as function args.
- EdwardDiego 4y agoWe should form a support group. Even though I'm pushing Mypy as hard as possible, there's some notable areas it can't help, like unittest.mock call assertions.
- ReflectedImage 4y agoOr you could use Python with microservices that talk over a message queue instead.
- packetlost 4y agoI hope this is satire.
- ReflectedImage 4y agoNo, it's one of the fastest ways in software development you can ship software features to the customer. Scripting language, dynamic typing, microservices and a message queue is shockingly effective. There is no way to compete with that if you are using traditional development techniques. It's why we watch videos online on Youtube and not Google videos. The Google developers got beaten up by the much smaller group of Youtube Python developers. To be honest, I find it shocking that the average user on hacker news doesn't know that software development using dynamic typing is considerably faster than software development using static typing.
- synthc 4y agoHaving used both statically and dynamically typed languages, I don't think this is true at all. Most modern languages are pretty close in productivity, architecture and the way a company is organized have much more impact on productivity. In big enterprises every small change requires 3 meetings, in a startup you can just make the change.
- ReflectedImage 4y agoThere are studies that show it is true: https://games.greggman.com/game/dynamic-typing-static-typing/ https://games.greggman.com/game/dynamic-typing-static-typing...
- synthc 4y agoBased on one guy who did a hobby research project based on GitHub issues?
- ReflectedImage 4y agoHave you ever of this little company called Youtube? Youtube did the dynamic typing thing in Python with 20 developers and Google did the static typing thing with several hundred developers in C++ for their Google Videos. Who do you think won? https://books.google.co.uk/books?id=eulODwAAQBAJ&lpg=PA136&dq=google+video+vs+youtube+python+story&pg=PA136&redir_esc=y#v=onepage&q=google%20video%20vs%20youtube%20python%20story&f=false https://books.google.co.uk/books?id=eulODwAAQBAJ&lpg=PA136&d...
- kaba0 4y agoYou can take out the engine from a car and tape it on the top, but that construction won’t be any less complex.
- neverartful 4y agoPython is strongly typed, but it is not statically typed. Statically typed is what you're after.