Live data from Hacker News

Python's “disappointing” superpowers

lukeplant.me.uk

11–20 of 264 posts

Re: Python's “disappointing” superpowers

#11

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 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 code ends up performing as well as any c++ code i could realistically write while being much more understandable.

Re: Python's “disappointing” superpowers

#12

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…

There have been some efforts to utilize the type hints to give performance boosts. There's a project called mypyc that apparently has been used by black (python formatting library) that will compile type hinted python into c extensions. Unfortunately I think development has stalled, but as more people start using type hints I think there will be more motivation for similar projects.

Re: Python's “disappointing” superpowers

#13

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…

The problem with separate prototyping languages is that the most permanent fix is always a temporary one. The prototype usually becomes the final product. If your language isn't suitable for use as a final product, then you're going to have a problem. If it's not suitable for writing a prototype, then you already have a problem.

Re: Python's “disappointing” superpowers

#14
post #4

> I’m worried that a de-facto move away from dynamic stuff in the Python ecosystem, possibly motivated by those who use Python only because they have to, and just want to make it more like the C# or Java they are comfortable with, could leave us with the very worst of all worlds. It is certainly happening, and I'm not sure Python the language is all the better for it. I say that as a guy who explicitly mentioned this…

eval() makes it harder to reason able your code and opens you up to injection attacks. Steering the boat toward C# or Java is better than crashing into TCL.

Re: Python's “disappointing” superpowers

#15
post #4

> I’m worried that a de-facto move away from dynamic stuff in the Python ecosystem, possibly motivated by those who use Python only because they have to, and just want to make it more like the C# or Java they are comfortable with, could leave us with the very worst of all worlds. It is certainly happening, and I'm not sure Python the language is all the better for it. I say that as a guy who explicitly mentioned this…

Over the years C# (and probably Java, but I'm not so well versed in that) gained quite a few features to improve "Meta-Programming", one could argue in an attempt to compete with dynamic languages. In C# that is mainly possible through introspection, generics and maybe dependency injection. Entity Framework Core can mostly figure out an SQL Table and its queries by looking at a simple class. It's not as good as the D…

How is SQLAlchemy or django better at any of that? in my experience EF is far far superior

Re: Python's “disappointing” superpowers

#17
post #3

Is there any language out there that improves on Python in various ways but still allows convenient access to literally the entirety of Python's ecosystem of libraries?

I've come to really enjoy programming in Nim. Note that Nim is very different language despite sharing a similar syntax. However, I feel it keeps a lot of the "feel" of Python 2 days of being a fairly simple neat language but that lets you do things at compile time (like compile time duck typing).

There's a good Python -> Nim bridge: https://github.com/yglukhov/nimpy

Re: Python's “disappointing” superpowers

#18

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…

The problem with separate prototyping languages is that the most permanent fix is always a temporary one. The prototype usually becomes the final product. If your language isn't suitable for use as a final product, then you're going to have a problem. If it's not suitable for writing a prototype, then you already have a problem.

That's why I love the idea of a language like Common Lisp. Performance, 'debugability', and flexibility in one package.

Re: Python's “disappointing” superpowers

#19
post #4

> I’m worried that a de-facto move away from dynamic stuff in the Python ecosystem, possibly motivated by those who use Python only because they have to, and just want to make it more like the C# or Java they are comfortable with, could leave us with the very worst of all worlds. It is certainly happening, and I'm not sure Python the language is all the better for it. I say that as a guy who explicitly mentioned this…

Over the years C# (and probably Java, but I'm not so well versed in that) gained quite a few features to improve "Meta-Programming", one could argue in an attempt to compete with dynamic languages. In C# that is mainly possible through introspection, generics and maybe dependency injection. Entity Framework Core can mostly figure out an SQL Table and its queries by looking at a simple class. It's not as good as the D…

Check the history of IronPython and IronRuby and how that spun the Dynamic Language Runtime, likewise do the same for jython, jTcl, jRuby and invokedynamic bytecode.

Re: Python's “disappointing” superpowers

#20
post #3

Is there any language out there that improves on Python in various ways but still allows convenient access to literally the entirety of Python's ecosystem of libraries?

Coconut, F# (Fable)... https://github.com/vindarel/languages-that-compile-to-python

F# is a great language... I wish I could use it at work.
Post reply on HN