5 ms·
You think you're being downvoted because people like dynamic typing very much. You're being downvoted because: A) You left a comment with a strong opinion wit
by inglor 7y ago
You think you're being downvoted because people like dynamic typing very much.
You're being downvoted because:
A) You left a comment with a strong opinion without expressing it while dismissing other peoples' experience
B) Python is in fact a type safe language for a while now https://docs.python.org/3/library/typing.html https://docs.python.org/3/library/typing.html - you have pluggable "a la bracha" types.
- enitihas 7y agoI think you meant dynamic typing and not dynamic programming.
- 0815test 7y ago> Python is in fact a type safe language for a while now Well it has a typing mechanism, which is better than nothing, but has the mechanism been shown to be safe? C has types too, but I'm not sure that it would be described as type safe.
- inglor 7y agoShowing a typing mechanism to be safe is a very hard thing to do. There are a few methodologies I'm familiar with. What most people think about - formal proof - doesn't work for semi-obvious reasons (as you can easily reduce "is this program safe" to the halting problem). The research I've seen is basically: - Take a class room of independently selected subjects (read: CS undergrad students). - Give them the same coding problem in multiple languages or in the same language with or without compile time type checking. - Measure the number of defects said programs have and hopefully draw a conclusion about the safety of the language. All the research I've read on the topic has been pretty poor (though maybe I'm just bad at finding it). Indeed there is no such research for typed Python (although the pluggalbe types research in general is great) but there is also no such research (that I've found) for Idris, ReasonML, Swift, Haskell, Rust or any of the usual "suspects" for "good types". Please enlighten me :]
- chrisseaton 7y agoC is weakly typed. Python is strongly typed. That's orthogonal to 'having types'.
- tsss 7y agoThere is no agreed-upon definition of weakly and strongly typed; It is a nonsense word. Any Haskell programmer would laugh at someone who calls Python strongly typed.
- weberc2 7y ago> There is no agreed-upon definition of weakly and strongly typed; It is a nonsense word. Sure there is. Strong typing means a language doesn't permit implicit type coercions. > Any Haskell programmer would laugh at someone who calls Python strongly typed. I'm sure lots of programmers are not particularly educated on the topic; it doesn't mean the word is 'nonsense'.
- philwelch 7y agoPython’s type annotation mechanism is somewhere between afterthought and joke. Nobody uses it and nothing is built with it in mind; it can be anywhere from needlessly complicated to utterly impossible for code that interacts with third-party libraries to successfully discover and import class names for type annotations. Making matters worse, you need to use even more extra libraries for the type annotations to actually do anything.
- inglor 7y agoI beg to differ, I've seen it adopted in quite a few places by large companies. I've rarely seen it used in startups though. My evidence is anecdotal (so is yours though). I definitely agree that it's not seeing nearly as much adoption as let's say... TypeScript in the JavaScript ecosystem though. Facebook even wrote a package to generate types automatically for existing code https://github.com/Instagram/MonkeyType https://github.com/Instagram/MonkeyType .
- mixmastamyk 7y agoRe: startups, it's more useful in a large, mature code-base rather than smaller projects still in the design-churn phase.
- vtomole 7y agoFWIW, we use mypy in Cirq (https://github.com/quantumlib/Cirq https://github.com/quantumlib/Cirq) and we haven't reached version 1.0 yet.
- philwelch 7y agoIt’s important to introduce it early enough that it’s still feasible to introduce it. Otherwise the architecture of the code will get in the way—defining classes deep within module hierarchies for objects that get returned up is painful.
- philwelch 7y agoI’m speaking from the personal experience of using it myself. I don’t doubt that some companies have large internal Python codebases with extensive type annotations. If you’re at one of those companies, maybe the experience of using those annotations rises from third-rate to second-rate. It’s never going to be comparable to a statically typed language, or maybe even a language designed from the ground up with optional static typing in mind. And that’s fine! Python is probably the best language in its niche. Type annotations just don’t do enough to break out of that niche. Annotated Python with mypy is a terrible statically-typed language. Python generally is an excellent dynamically-typed language.
- erk__ 7y agoYeah it is a bit strange argument to use "type safe", the better wording would probably have been to use a statically typed language which is more what is getting more and more popular at the moment.
- kbumsik 7y ago> Python is in fact a type safe language for a while now I like the idea of type annotators but they do not make it a type safe language because types are not checked and they are more like comments. Python will remain a dynamically typed language, and the authors have no desire to ever make type hints mandatory, even by convention.[1] [1]: https://www.python.org/dev/peps/pep-0484/#non-goals https://www.python.org/dev/peps/pep-0484/#non-goals
- chc 7y agoThis is only true if you don't use a type checker. If you do use a type checker...types are checked. It's still not really a sound type system, though. Many safe languages have some kind of escape hatch for the type system, but the escape hatches are very close at hand in Python's typing and you see them used several orders of magnitude more often.
- Too 7y ago-Wall -Werror is also optional in GCC... Not that i like it but just to show that a lot of languages require a properly set up configuration and CI-infrastructure to make them safe and useful. mypy should be considered equal to -Wall -Werror and anyone who doesn't run it is frankly a bloody idiot.
- luord 7y agoYour entire reason for calling people not doing what you do "bloody idiots" stems from your opinion that static typing is superior. It isn't, you're just contributing to a flamewar that has been going on since computers have been a thing.