3 ms·
I do most of my work in python, but the one thing that I use all the time and makes my life easier is types. I was introduced to types via c++ and java and havi
by hyperion2010 12y ago
I do most of my work in python, but the one thing that I use all the time and makes my life easier is types. I was introduced to types via c++ and java and having to declare them explicitly gives (imo) a much more concrete idea of what a program is actually doing. You can learn a little bit about types in python, but their connection to correctness and strange bugs (in python) is hidden by the dynamic type system.
So while I like python a lot and use it as often as I possibly can, I think it hides one of the key elements that distinguishes of thinking like a computer scientist from just thinking logically. Computers are all numbers, types give numbers meaning and provide strong tools for intuition. Python hides that.
- xyzzy123 12y agoI went the other way :) I find that I rarely get confused about the types of the things that I'm manipulating, and in practice I find that the problems I have are unexpected behavior from say third-party web APIs, surprising data at system boundaries and so on. Usually I try to mitigate this by introducing a "type system" (or more accurately, declarative data validation enforced at runtime) near the boundary of the application, such as a parser, JSON schema, option parser, etc. The biggest thing I do miss in Python is solid and natural concurrency. Gevent is the closest I've found, but it doesn't play as nicely as I would like.