Live data from Hacker News

Python's “disappointing” superpowers

lukeplant.me.uk

71–80 of 264 posts

Re: Python's “disappointing” superpowers

#71

Earlier quoted context omitted.

A lot of the orm style things are not really feasible in static-er languages without clunky approaches like codegen.

What part specifically? Java is (in)famous for its orms after all. Unless you want to count that as clunky codegen? I'd argue that all metaprogramming boils down to that though.

Unless you want to count Java as clunky? Well, I definitely think Java is clunky. This article by Steve Yegge, titled "Execution in the Kingdom of Nouns" sums up Java for me: https://www.eecis.udel.edu/~decker/courses/280f07/paper/King...

Re: Python's “disappointing” superpowers

#72
post #66
post #46

Earlier quoted context omitted.

How come everyone realised the benefits of typing by now, except the Python community?

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.

Could you give an example of a type of application where typing is a hindrance?

Re: Python's “disappointing” superpowers

#73

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.

LISPs are the quintessential metaprogramming languages, and they learnt the lesson of "use macros sparingly and only as the last resort" very early on.

Re: Python's “disappointing” superpowers

#74

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?

And most of that python2 code is completely rotted.

By definition, since it won't run on a supported runtime.

Re: Python's “disappointing” superpowers

#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 advantages, and you have nice tools like python has which execute at COMPILE time using DSL, which are type safe themselve..

Python has become mostly a toy language for me to write scripts in.

Re: Python's “disappointing” superpowers

#76
post #46

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?

How come everyone realised the benefits of typing by now, except the Python community?

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

#77

When I did most of my work in Python, typehints weren't a thing. I still feel like static typechecking is less useful in Python since its datamodel is overally less of a hot mess compared to Javascript for example. And Python modules/frameworks can be a lot more "typed" than you'd expect. Django models, forms etc offer more runtime validation than typesystems can easily achieve. Yes, at runtime. But between not havin…

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

OP is not saying that type checking is useful. They’re saying that it’s not as useful.

Re: Python's “disappointing” superpowers

#78

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.

Yeah thought so too... in particular the example where you pass a a generator to a db, the generator isn't actually executed, and instead the expression is parsed & transformed to SQL.

This is cool if it works. Good luck when it doesn't due to user error, and more luck if it doesn't due to a bug.

You need to develop a whole strategy to tell the user what went wrong and how, and why, basically from scratch; admitting that you didn't, in fact, execute the generator, and that they have to change it. because of that.

It's pretty awesome that it's possible. And it would be pretty amazing to write something like that. But... idk if it's a good idea from a developer stand point. I like being able to understand what's happening in a library with a single click.

Re: Python's “disappointing” superpowers

#79
post #66

Earlier quoted context omitted.

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.

Could you give an example of a type of application where typing is a hindrance?

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.
Post reply on HN