6 ms·
How come everyone realised the benefits of typing by now, except the Python community?
by 9dev 4y ago
How come everyone realised the benefits of typing by now, except the Python community?
- pdonis 4y agoThe benefits of typing for certain kinds of applications. Many people in the Python community simply aren't writing those kinds of applications. They're writing applications where typing is not a benefit, it's a hindrance, so they don't use it, and Python makes that easy.
- zerodensity 4y agoCould you give an example of a type of application where typing is a hindrance?
- randomluck040 4y agoNot a hindrance but I work with image data a lot. Usually what comes in is any kind of Numpy array and what comes out at the end is either statistics or a Numpy array. I try to type hint everywhere I can but I feel stupid doing so because all I do is work with arrays. Maybe I’m not proficient/knowledgeable enough though so take it with a grain of salt.
- zerodensity 4y agoIf it's truly "any" kind of Numpy array typing won't help much there I agree. But often it can be helpful to know the shape of the input and the shape of the output. Eg are we working with a 2D,3D or ND array. Before 3.11 it was not simple (possible?) To type this. But https://peps.python.org/pep-0646/ https://peps.python.org/pep-0646/ makes it possible. If somewhat clunky on the definition side.
- spookylukey 4y agoI did a fairly detailed breakdown regarding the Python library Parsy: https://lukeplant.me.uk/blog/posts/python-type-hints-parsy-case-study/ https://lukeplant.me.uk/blog/posts/python-type-hints-parsy-c... This is not to make the general claim "Typing is a hindrance in parsing applications", or anything close. It's saying "the current static type system(s) available in Python would have made this Python library much worse".
- arcturus17 4y agoI’m also part of the Python community and I use typing extensively. I find them useful for app development but also in scripting. There must be at least be a good dozen of us seeing the popularity of mypy, pyright and the fact that the language designers saw fit to add them, too.
- scrollaway 4y agoBecause python got a half baked, overall poor quality type hinting system so devs that haven’t been exposed to the benefits of eg. Typescript don’t understand why this is better. Many of us in the python community know the benefits, and we’re simply changing our stack so python is as contained as possible, and dropping lower quality libraries for higher quality typed ones.
- llanowarelves 4y agoNot to be rude, but scientific/ai/data scientists are typically not the best "programmers" (best practices and code hygiene) , and their stuff is the main reason to be on Python these days (other than for small CLI and scripts), which pulls everything around into it like a black hole ("oh let's make the api in Python too, to keep it one language"). And Python has a ton of newbies, college kids etc. Though this is also true of JavaScript. As an industrial language/environment with best practices for very large codebases, it's really weak and I much prefer TypeScript despite the occasional tooling fatigue (has slowed down). But a ton of money has been poured into JavaScript (v8) which really set that into motion.
- ReflectedImage 4y ago[flagged]
- Jtsummers 4y ago> Developing with static typing reduces development speed by 2.5x and increases bugs by 2.5x per the emperical studies on the topic. I hate "Citation needed" comments, but this is a very strong claim and so deserves it: Citation needed
- ReflectedImage 4y ago[flagged]
- Jtsummers 4y ago> It's not a very strong claim, it's due to dynamic typing enabling the writing of more concise programs. The number #1 bug elimination tool is to simply write less code. It is a strong claim, it's also a very precise claim. Where do your numbers come from? Haskell and the ML family of languages also permit you to write much more concise programs than many other languages and they're definitely statically typed. How do they fare in your imaginary analysis? > As a matter of principle, I won't provide citations unless you first provide some citation that says I'm wrong first. (You won't find one) Ok, so you're an idiot. Got it. You can't make such a strong and precise claim and not back it up, and try to turn the tables by saying "No your citation!". You just come off like a petulant child (maybe you are?). Your claim makes no sense, and anyone who has at least 5 years of experience (probably less, actually) would know that. You've asserted there are empirical studies on the topic to back your numbers. Just provide them.
- ReflectedImage 4y ago[flagged]
- spoils19 4y ago