Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

691–700 of 856 posts

Re: Ask HN: Why did Python win?

#691

Earlier quoted context omitted.

I believe what you describe is basically a preference for a language you already know. I'm quite proficient in JavaScript and could repeat everything you say about ... JavaScript. OTOH I had to do things in Python a bunch of times, and it was always very frustrating.

The JavaScript ecosystem is objectively smaller. JavaScript doesn’t have a foothold in data science and ETL, nor deep learning, nor DevOps. There are no decent ORMs in JS, and Python has several. JS is poor for numerical and scientific programming.

Python has smaller footprint in webdev backend and practically non-existent on the frontend :-D

But I think this thread is about being comfortable with the language itself rather than an ecosystem.

Re: Ask HN: Why did Python win?

#692
post #532

Earlier quoted context omitted.

> Python basically solved this problem by wrapping around C code I would rather call it a work-around. Having to switch to a vastly different language to get halfway decent performance is hardly a good solution. It's not a rare thing in normal applications that you need to have some routine fast and there's no pre-built C solution for it.

Maybe so, but it's not like there are a lot of languages around that are as expressive, flexible and easy to learn as python, but as fast as C. JS is probably the closest, but not because of superior language design -- people with money wanted it to be faster, so it is. Also, the choice is not just python, or writing a module in C -- there's numba and cython, various python compilers, pypy and cffi.

> Maybe so, but it's not like there are a lot of languages around that are as expressive, flexible and easy to learn as python, but as fast as C.

There are several languages on the JVM which are that or better. As fast as C, no, but JVM is considered fast enough for a lot of applications where performance matters.

> JS is probably the closest, but not because of superior language design

There's this myth that Python as a language is superior to JS. In reality both have their long history and warts. JS/V8 is just much faster.

For me personally, JS is a much more ergonomic language than Python.

Re: Ask HN: Why did Python win?

#693

Earlier quoted context omitted.

> Python basically solved this problem by wrapping around C code I would rather call it a work-around. Having to switch to a vastly different language to get halfway decent performance is hardly a good solution. It's not a rare thing in normal applications that you need to have some routine fast and there's no pre-built C solution for it.

It is a great solution. If you write Python, nobody will mistake it for fast code, it stays where it belongs. JavaScript for example is much worse, because people are convinced it can be fast for some reason, and keep trying to write nested loops in it.

These mental excuses are pretty funny :-D

One problem with this is that you expect a perfect dichotomy where you can isolate code which can be slow and which can be fast. But for a lot of code it's not easy to say in advance (pre-mature optimization plays a role too) and/or it's somewhere in the middle.

We have a big Java application with hundreds of thousands lines of code. Its performance is so-so. But if you look at the profiler, there isn't a clearly responsible module/method (all obviously slow methods have been already optimized). Now it's a death by a thousand cuts. Making it in Python would make it unacceptably slow with no obvious places which could be converted into C. Writing the whole thing in C would make it a much more complex endeavor.

Re: Ask HN: Why did Python win?

#694
For me it was the cross-platform batteries-included standard library, which could completely replace Windows batch files and UNIX shell scripts with a single solution that was also much more convenient to write. At that time node.js was still a decade into the future.

Today I'm starting to move from Python to Deno though. I'm still fed up with how bad the Python2 to Python3 transition went, and Python3 has all the wrong goals for what I'm using it for (it tries to be a "real" programming language, when I just want a cross-platform scripting language).

Re: Ask HN: Why did Python win?

#696
post #668

Earlier quoted context omitted.

Was simply for readability, as in similar to English prose. What if the length of my list is greater than 10? if len(mylist) > 10: pass Only general things dealing with common needs are global, list-centric methods are on the list where they belong. I learned Java before Python and don't really miss value.toString() or value.length() much.

But it is absolutely unintuitive why it shouldn't be if mylist.length > 10

If the length of mylist ... see how length comes first? Only unintuitive if you never spoke English or other european languages.

Re: Ask HN: Why did Python win?

#697

Earlier quoted context omitted.

> But Python is -dramatically- better focused, as a community, on finding a Pythonic way to proceed, and then advocating it, than previous cultures. I would revise that to be that the pythonic culture of one acceptable way to to is better matched with a lot of good development practices. Perl was also very good at finding a Perl way to proceed. It's just that with Perl that often mean a lot of implicitness and "do wh…

Not just practices, tooling. The whole typing system. Linting to check for mistakes. For the love of black.

Isn't Python's tooling usually considered some of the worst?

Re: Ask HN: Why did Python win?

#698

Python ended up 'specializing' in data contexts, thanks to Numpy / Pandas, and as a result, ended up becoming the first exposure to programming than anyone doing data stuff had. That was millions of people. In that space, it had no competitors. Ruby ended up 'specializing' in web dev, because of Rails. But when Node and React came out, Ruby on Rails had to compete with Nodejs + React / MERN as a way of building a web…

I think Python was popular as a general-purpose language first. After all, there was a reason people put so much effort into writing Numpy in the first place. I think a lot of people were attracted to the language design, as captured in the Zen of Python ( https://peps.python.org/pep-0020/ ), such as: Explicit is better than implicit. Readability counts. Errors should never pass silently (unless explicitly silenced)…

> I think Python was popular as a general-purpose language first.

Is that true? My understanding was that it was a scripting language first (still is), but then got taken up by data and science people and various other niches. Then some education books and courses, like the Artificial Intelligence: A Modern Approach and later MIT and other university adopters. And all of that began to snowball where Python was either the only or main language people knew, so they started using it for everything indiscriminately.

Re: Ask HN: Why did Python win?

#699

Earlier quoted context omitted.

The only ruby person i've met was insistent that ruby was the one true way and he trued to force it into everything. That attitude turned me off. Of course I already knew Python, and so did the rest of my team so we had been doing tools in Python (the guy wasn't on my team), but until he pushed ruby into places where python would have been better (import a Python library rather than shell to out to a program) I was w…

> The only ruby person I've met was insistent that ruby was the one true way and he trued to force it into everything. That attitude turned me off. I mean, if you read almost any Elixir article that has hit the front page of HN, there are always comments from Pythonistas saying, "Why bother when there's Python?" Similar attitude. Obviously it's not everyone, but it's not everyone in the Ruby community either.

It’s such a bizarre reason. “One person using something rubbed me the wrong way so I decided not to use it”. Did the person extrapolate to an entire community from a sample size of 1?

Re: Ask HN: Why did Python win?

#700
Operator overloading + great interop with C - the ultimate cross platform (and most popular) language

Great standard library (Javascript still doesn't have one). Even better than Java's

Cross-platform

Interpreted language with minimal environment needs where just having python.exe is enough (compare build systems C or Java, or environment setup needed for PHP/perl)

Great DX given how simple core syntax and standard libraries are (again, compare with perl magic, or PHP madness)

Early numpy/scipy packages found amazing uptake in science community which acted as evangelists. This happened to great DX (scientists don't like coding C) and great C support (they still need C speed)

Post reply on HN