Hacker News new | ask | show | jobs
by IshKebab 1491 days ago
There's an element of truth to that in some cases, but it's mostly just something Python fans say to excuse the fact that Python is so slow.

It's not true for two reasons:

1. In practice writing a prototype in one language, then completely scrapping it and rewriting it in another language almost never happens for fairly obvious reasons.

2. The "slow bits" of a Python program are rarely neatly concentrated in a few parts of the program that you can rewrite in a fast language. The whole program is slow, so there's no small part that you can rewrite to make it all faster.

3. There are other languages that are just as easy to use as Python (easier even!) but are also fast enough that you don't need to rewrite anything in most cases. Typescript is probably the best option at the moment but there's also Dart, Lua and probably others I've forgotten.

Python is popular because it's seen as very beginner friendly so there's a mountain of content out there teaching people Python. Also the REPL makes it good for beginners and for science.

2 comments

The opposite is more plausible: it is rare when your performance issues are distributed evenly through the code.

The very words such as bottleneck/hotspot indicate that it is common to get the most benefit by optimizing small parts of the code.

The fact that the words bottleneck and hotspot exist doesn't imply that they are common.
The point is you're very productive up front, and have a number of choices with the rest of your time. Few rewrite from the ground up because they don't need to.