Live data from Hacker News

Python's “disappointing” superpowers

lukeplant.me.uk

141–150 of 264 posts

Re: Python's “disappointing” superpowers

#141

Earlier quoted context omitted.

Citation heavily, heavily needed. Dynamic typing means that none of your code can be statically checked, which means that correctness relies on the exhaustiveness on your tests. It should be obvious that this would allow you to introduce more bugs, not fewer. Every program involves passing around data. When you need to change that data in a dynamic untyped language, you have no option but to manually test your whole…

[flagged]

[deleted]

Re: Python's “disappointing” superpowers

#142

Metaprogramming does not require dynamic types, but this post seems to equate them. As far as I can see all this could be done in e.g. Java (and probably is). IME this kind of "magic" very quickly loses its appeal when you have to debug it. The author's idea of libraries wrapping this stuff up so users don't have to care about it just doesn't pan out at all in my experience.

> just doesn't pan out at all in my experience.

Fine! These things are based on metaprogramming; chances are you've used some of them.

* In nearly any language, nearly any ORM, for describing tables / models.

* In Rust, serde, and nearly everything you #[derive].

* In Java, Lombok, Hibernate, and most dependency-injection tools.

* In Java, most mocking / stubbing libraries.

* In Python, tons of stuff, from standard library (dataclasses, namedtuples) to various parts of Django, etc.

Judging by the sustained and widespread use of these things, they are not exactly complete failures.

Re: Python's “disappointing” superpowers

#143

Earlier quoted context omitted.

> 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…

[flagged]

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

#144

Earlier quoted context omitted.

Citation heavily, heavily needed. Dynamic typing means that none of your code can be statically checked, which means that correctness relies on the exhaustiveness on your tests. It should be obvious that this would allow you to introduce more bugs, not fewer. Every program involves passing around data. When you need to change that data in a dynamic untyped language, you have no option but to manually test your whole…

[flagged]

> No citation is needed, it's fairly obvious to any experienced Python programmer.

So you can't even explain it, despite claiming to be experienced. Why should I listen to you? Your whole response is just you saying "First off, you're wrong. Second off, I'm right."

Here's a very simple example: I want to change a dict to a class. In untyped Python, how do you make sure that you make this change safely without introducing new bugs into your application?

Re: Python's “disappointing” superpowers

#145

Earlier quoted context omitted.

[flagged]

Static typing is not just about code performance, it’s absolutely about correctness as well. I would really love to see that study as it flys in the face of all my experience

https://games.greggman.com/game/dynamic-typing-static-typing...

Re: Python's “disappointing” superpowers

#146

Earlier quoted context omitted.

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.

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 slig…

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

#147

I kinda hope we can just let Python be Python: it’s in a global-ish maximum for what it’s for, and I suspect any big move away from that will make it worse overall. Obviously things like UTF-8 support, or maybe getting a clean lexical scope option, or other “fixes” are good. Performance improvements are good. But there are lots of mainstream languages that have mature static type systems, strong metaprogramming facil…

Nit: Python has strong metaprogramming facilities since version 2.2, when "types" and "classes" were made equal, and it became trivial to create a class using the `type` function. It's so easy exactly because Python is so dynamic.

Re: Python's “disappointing” superpowers

#148
post #65

Earlier quoted context omitted.

> its datamodel is overally less of a hot mess compared to Javascript for example. I don't understand this, what do you mean? TypeScript is such a success partly because everything is an object in Javascript. There's no need to distinguish between classes and "dicts", as you have to with Python. Another example: Python functions have args and kwargs, which make typing significantly more complex (as the article points…

> everything is an object in Javascript Everything is an object in Python too. > There's no need to distinguish between classes and "dicts", as you have to with Python. "dict" in Python (or at least Python 3, but Python 2 is EOL now so Python 3 is the only active Python there is) is a class. You can even subclass it, which if you want a customized dict for some reason in your particular application is often the best…

> Everything is an object in Python too.

Ah yes, true. JavaScript goes one step further though, and has no distinction between get-item accesses and attribute accesses. This makes TypeScript's data model much simpler to manage. Is it even possible to implement your own `MutableMapping` or `dataclasses` equivalent type in Python? I know the latter requires custom plugins.

Re: Python's “disappointing” superpowers

#149
I used to be a huge dynamic languages fan, with python being my favorite language over the majority of my career. Then I worked on a large python project of ~100k LOC with a team of ten. That's when I realized that writing code faster isn't the problem. Reading it is, making changes to code someone else wrote is, and refactoring across dozens of modules is a problem. Static languages help a lot with all three. I still love dynamic languages for small tasks, but I'd rather use a static language like Go which still keeps much of the dynamic feel, and helps catch my mistakes at compile time. I actually just set it to watch the project directory for changes and recompile automatically in a terminal on another screen (actually to run the unit tests, which includes compiling.) That's constant feedback and comparable to dynamic languages speed for edit-compile-test runs. But the best part is the unit tests. They run so much faster with Go that I don't get distracted waiting for them to finish, and that keeps me in the zone and much more productive.

Re: Python's “disappointing” superpowers

#150
post #75

All these features are nice and stuff... But they are often runtime features... At compile time Python doesnt tell you wether a program is correct. Which is fine for small programs or small services. But any big system is written in python is really hard to maintain without LOTS of unit tests... Static typing, compile time checks just win in the long run. And with languages like kotlin you still have all the advantag…

Yes but a linter can
Post reply on HN