News for hackers. Stuff that matters.
Re:Python's “Disappointing” Superpowers by wheelerof4te on Wednesday February 01, 2023 @03:15PM (#34616920)
Either embrace dynamic typing and provide good error guards...or try to use type hints and still make good error guards.

We had an entire history of Python 2 without type hints. Why use them now?

Re:Python's “Disappointing” Superpowers by ok123456 on Wednesday February 01, 2023 @03:32PM (#34617205)
And most of that python2 code is completely rotted.
Re:Python's “Disappointing” Superpowers by markrages on Wednesday February 01, 2023 @04:42PM (#34618274)
By definition, since it won't run on a supported runtime.
Re:Python's “Disappointing” Superpowers by 9dev on Wednesday February 01, 2023 @03:51PM (#34617527)
How come everyone realised the benefits of typing by now, except the Python community?
Re:Python's “Disappointing” Superpowers by pdonis on Wednesday February 01, 2023 @04:19PM (#34617934)
The 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.

Re:Python's “Disappointing” Superpowers by zerodensity on Wednesday February 01, 2023 @04:39PM (#34618230)
Could you give an example of a type of application where typing is a hindrance?
Re:Python's “Disappointing” Superpowers by randomluck040 on Wednesday February 01, 2023 @04:45PM (#34618320)
Not 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.
Re:Python's “Disappointing” Superpowers by zerodensity on Wednesday February 01, 2023 @05:04PM (#34618579)
If 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/ makes it possible. If somewhat clunky on the definition side.

Re:Python's “Disappointing” Superpowers by spookylukey on Wednesday February 01, 2023 @05:05PM (#34618596)
I did a fairly detailed breakdown regarding the Python library Parsy: 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".

Re:Python's “Disappointing” Superpowers by arcturus17 on Wednesday February 01, 2023 @05:11PM (#34618670)
I’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.
Re:Python's “Disappointing” Superpowers by scrollaway on Wednesday February 01, 2023 @04:17PM (#34617897)
Because 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.

Re:Python's “Disappointing” Superpowers by llanowarelves on Wednesday February 01, 2023 @04:43PM (#34618285)
Not 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.

Re:Python's “Disappointing” Superpowers by ReflectedImage on Wednesday February 01, 2023 @05:32PM (#34618962)
Developing with static typing reduces development speed by 2.5x and increases bugs by 2.5x per the emperical studies on the topic.

There isn't a benefit to static typing in Python, it's a massive drawback.

Re:Python's “Disappointing” Superpowers by Jtsummers on Wednesday February 01, 2023 @05:43PM (#34619082)
> 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

Re:Python's “Disappointing” Superpowers by ReflectedImage on Wednesday February 01, 2023 @06:00PM (#34619308)
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's like Youtube reducing bandwidth in streaming videos, a better compression algorithm can't compete with simply asking the end user if they are stilling watching the stream.

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)

Re:Python's “Disappointing” Superpowers by Jtsummers on Wednesday February 01, 2023 @06:03PM (#34619363)
> 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.

Re:Python's “Disappointing” Superpowers by ReflectedImage on Wednesday February 01, 2023 @06:14PM (#34619508)
Emperical studies on the topic. Next question.

Well I don't know since I haven't read studies about Haskell and the ML family of languages. I suspect good things about Rust's borrow checker but I still don't know for sure.

I don't believe it is a strong claim. That's entirely in your head. It might not be a claim you like but that doesn't make it a strong claim.

So provide a citation saying something different to what I'm saying and I'll provide my citations. You have asked for a citation, so the first thing you can do is provide one of your own. Come on, you can do it! (Hint: You can't)

If it really was a strong claim, you could disprove it easily.

Re:Python's “Disappointing” Superpowers by spoils19 on Wednesday February 01, 2023 @06:18PM (#34619565)
I support you ReflectedImage - seems like these people just don't know how great dynamic languages can be! My team has actually seen a 30x decrease in bugs, and a 50x increase in productivity ever since switching to Python.
Re:Python's “Disappointing” Superpowers by ReflectedImage on Wednesday February 01, 2023 @06:28PM (#34619682)
Well a lot of people are claiming that static typing reduces bugs compared to dynamic typing, but I haven't seen from them a shred of evidence of this.

When I go looking for myself what I found was studies saying that dynamic typing reduces development time by 2.5x and bugs per software feature by 2.5x.

So perhaps one of these people claiming that static typing reduces bugs over dynamic typing, could provide the slightest bit of evidence to backup their claims?

Is that too much to ask @spoils19?

But I'm pretty sure they will just find the exact same figures as me.

Re:Python's “Disappointing” Superpowers by mountainriver on Wednesday February 01, 2023 @07:07PM (#34620131)
In the amount of time you’ve repeatedly said this all over this thread you could have provided a citation
Re:Python's “Disappointing” Superpowers by ReflectedImage on Wednesday February 01, 2023 @07:26PM (#34620268)
Here: https://games.greggman.com/game/dynamic-typing-static-typing...

I think it's more effective to show that there is no evidence to contradict me first.

Re:Python's “Disappointing” Superpowers by mountainriver on Friday February 03, 2023 @06:38PM (#34649431)
lol wow you're really something, this is literally one guy, there is TONS of research on this which contradicts his findings. This guy does a pretty good summary https://danluu.com/empirical-pl/ definitely heavier on the research wouldn't you say?

He also misses the biggest add of typing your code which is that other people can understand it better. This is often lost on junior programmers...

Re:Python's “Disappointing” Superpowers by ReflectedImage on Saturday February 04, 2023 @09:24AM (#34654700)
Well according to most of that research I'm correct.

See: "Work In Progress: an Empirical Study of Static Typing in Ruby; Daly, M; Sazawal, V; Foster, J."

See: "Haskell vs. Ada vs. C++ vs. Awk vs. ... An Experiment in Software Prototyping Productivity; Hudak, P; Jones, M."

Lisp - A dynamically typed language had the lowest development time by a factor of 2.5x. Seems to be the same figure I'm giving, fancy that!

"He also misses the biggest add of typing your code which is that other people can understand it better."

Nope.

See: "How Do API Documentation and Static Typing Affect API Usability? Endrikat, S.; Hanenberg, S.; Robbes, Romain; Stefik, A."

You need documentation and whilst Java students may study with dynamic typing since they haven't been taught it, it's pretty clear that on it's own static typing provides almost no useful documentation.

"This is often lost on junior programmers..." I'm far more experience than you, which is why I'm calling out the BS.

I think you will find that the research suggests that static typing and dynamic typing have a similar bug rate per line of code.

See: "A Large Scale Study of Programming Languages and Code Quality in Github; Ray, B; Posnett, D; Filkov, V; Devanbu, P"

Once you combine that knowledge with the knowledge that dynamically typed programs have less lines per feature.

Relational Lisp 274 compared to Ada 767 or C++ 1105.

Dynamic typing wins out because the programs are smaller, making them faster to write and contain less bugs per software feature.

The link you posted confirms it.

Do you understand that you are wrong?

Re:Python's “Disappointing” Superpowers by vore on Wednesday February 01, 2023 @07:05PM (#34620105)
This argument is in such bad faith it's hilarious.

Here's my much better argument: Instead of using dynamic typing, eating babies reduces the incidence of bugs in code by 1000x. If you don't believe me and would like me to cite a source, you first provide a citation saying something different to what I'm saying and I'll provide my citations. Come on, you can do it! (Hint: You can't)

If it really was a strong claim, you could disprove it easily.

Re:Python's “Disappointing” Superpowers by ReflectedImage on Thursday February 02, 2023 @06:53AM (#34625337)
And yet I eventually provided evidence for what I'm saying and the other party provided nothing at all.

It's not bad faith because you don't like the arguments conclusions.

Re:Python's “Disappointing” Superpowers by anhner on Wednesday February 01, 2023 @05:45PM (#34619112)
Any source for those made-up-sounding numbers?
Re:Python's “Disappointing” Superpowers by ReflectedImage on Wednesday February 01, 2023 @06:01PM (#34619329)
Yep. Loads. But why don't you go find a source that says I'm wrong?

I'm sure you can, right?

Re:Python's “Disappointing” Superpowers by hmry on Wednesday February 01, 2023 @06:26PM (#34619653)
Could you name some of those studies? I would be interested in reading them
Re:Python's “Disappointing” Superpowers by lmm on Wednesday February 01, 2023 @06:29PM (#34619694)
We had an entire history of stupid errors (like field name typos), excessive test coverage (and associated maintenance burden) to catch those stupid errors, and everything breaking every time you upgraded a big framework (like Django) even with all of those tests in place.
Re:Python's “Disappointing” Superpowers by codexb on Wednesday February 01, 2023 @07:49PM (#34620486)
Spoken like someone who's never had to step into a 2 million line python library and try to decipher or debug it.

Also, we've been using non-standard type hints for nearly all of python 2, they were just non-uniformly specified in docstrings and weren't easily referenced or introspected for tooling and IDE's to work with them.