Live data from Hacker News

Python's “disappointing” superpowers

lukeplant.me.uk

91–100 of 264 posts

Re: Python's “disappointing” superpowers

#91

While this might be about my most unpopular opinion, it feels like it is time to start putting together a Python 4.0. I don't particularly have skin in the game but there is(?) enough meat on the bone around things like improving the GIL status quo, JIT compiling, static typing, and presumably etc. to be worth a breaking change.

That's definitely an unpopular opinion. The 2 to 3 change caused a lot of pain. I can't see the python community attempting that again.

Re: Python's “disappointing” superpowers

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

What does "compile time" even mean for Python?

The moment you run the script, before it actually gets executed.

Re: Python's “disappointing” superpowers

#93

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.

Isn't the C preprocessor a type of metaprogramming?

Yes since metaprogramming is just programming that generates, modifies, or extends other programs.

Re: Python's “disappointing” superpowers

#94
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.

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

#95

Earlier quoted context omitted.

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.

Java is actually a very dynamic runtime with a very static language front end.

The thread is about programming semantics though, so what does that have to do with anything?

Re: Python's “disappointing” superpowers

#96

Earlier quoted context omitted.

I routinely use cython to compile python for heavy workloads. A big part of the ~10x speedup i usually see comes from strategically assigning true static types to certain variables that get frequently iterated or compared. Most variables are left as standard python as it isn't necessary to change them for performance. My experience has been that cython "just works" even with lots of external libraries etc, and the co…

> I routinely use cython to compile python for heavy workloads. an alternative is rust + pyo3 https://pyo3.rs here's a web framework written with it, https://robyn.tech the other poster child for pyo3 is polars, https://www.pola.rs it's simply, amazing.

I'm so glad I found Polars. I replaced the most time-consuming parts of my Pandas code with Polars and it has reduced data manipulation times by literally 90-95%.

Amazing is not an overstatement.

Re: Python's “disappointing” superpowers

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

> At compile time Python doesnt tell you wether a program is correct.

This is a general limitation of type systems, IIUC. If you want a type system to guarantee 100% program correctness, I think it can't handle an arbitrary Turing-complete program.

Disclaimer: I'm not sure I really understand this topic, so take this with a grain of salt.

Re: Python's “disappointing” superpowers

#98

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.

Isn't the C preprocessor a type of metaprogramming?

it's probably discard as being string-based, you could do the same with sed

Re: Python's “disappointing” superpowers

#99

I maintain Python code bases for a living, and feel that the language has simply been pushed too far. Static typing in Python doesn't give you the advantage of actually static typing and even IDE support is -- well it's not terrible, just not great. The thing is, once we go through all this static typing exercise in Python, we get no performance advantages, and the whole thing seems bolted on, with worse semantics th…

I also maintain a large python codebase at work, typing makes things simpler. For example using pydantic 90% of serialization code just goes away. Mypy eliminates a large number of bugs. Also when working with multiple people in the same codebase typing makes intent so much clearer. The type system itself is not perfect but it's a clear improvement of not having it at all.

I could not agree more. I’m fairly language agnostic but typed Python with pydantic is a joy to work with.

Re: Python's “disappointing” superpowers

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

No programming language tells you if a program is correct at compile time. Type errors aren't a very common type of bug either.
Post reply on HN