Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

541–550 of 856 posts

Re: Ask HN: Why did Python win?

#541

Earlier quoted context omitted.

> There should be one-- and preferably only one --obvious way to do it. This is so hilariously wrong in python though

As evidenced by the unified Python library / dependency management system.

Use Poetry to produce a lockfile (or whatever lockfile-producing tool you like), and then let Nix take the wheel. It solves the dependency problem not just for Python, but for your entire stack. I've been able to hand it off to my coworkers and have everything just work with a simple "nix-shell" command, even with a dependency tree chock full of gnarly ML libs.

Re: Ask HN: Why did Python win?

#542

Earlier quoted context omitted.

> There should be one-- and preferably only one --obvious way to do it. There’s not even one obvious flavour of Python to use.

It's hard for me to name a problem domain that doesn't have 3 different python packages doing the same thing three different ways, each more clever and less understandable than the last.

Why TF would you name an HTML parser BeautifulSoup?

Re: Ask HN: Why did Python win?

#543

Earlier quoted context omitted.

Back when I decided it was time to add a scripting language, Perl and Python seemed like the obvious choices, and in my mind were equally good options. I asked my best friend which I should choose, and he more or less said, "You can't go wrong with either one, but when you ask for help Perl people are assholes and Python people are nice." I can't confirm his thoughts on Perl and I haven't interacted much with Ruby, b…

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…

Python and Ruby have some things where the intuitions are exactly inverted from one another. It took me a long time to figure out why Python rubbed me the wrong, and that if I dig up how I used to structure code in Pascal, it’s fine.

Not that I care much these days since I prefer writing in Elixir.

Re: Ask HN: Why did Python win?

#544

Earlier quoted context omitted.

That sounds trivial? I mean, you can do that in C, what’s surprising about it? I have never found Python as nice to use as you seem to have, but Ruby always fit like a glove. I’ve written Python since 1999 and I still would rather use almost anything else. It’s so labored to do anything complex. You can build worlds in Ruby in the time it takes you to align indentation properly for a single class in Python.

> That sounds trivial? I mean, you can do that in C, what’s surprising about it? Here's the C version of it: #include int addFive(int num) { return num + 5; } int call(int(*func)(int), int value) { return func(value); } int main() { printf("%d\n", call(addFive, 10)); return 0; } It's still manageable, but not nearly so simple. Even Perl doesn't let you escape having to consider pointers and references: sub addFive {…

  int call(int(*func)(int), int value) {
      return func(value);
  }
At least in gcc, you don't need to think about pointers. Just use the function signature:

  int call(int func(int), int value) {
      return func(value);
  }
I don't know if this is an extension or what, but it's something I "just tried" on a hunch with no guide in 2009 and it worked.

Re: Ask HN: Why did Python win?

#546

Earlier quoted context omitted.

Back when I decided it was time to add a scripting language, Perl and Python seemed like the obvious choices, and in my mind were equally good options. I asked my best friend which I should choose, and he more or less said, "You can't go wrong with either one, but when you ask for help Perl people are assholes and Python people are nice." I can't confirm his thoughts on Perl and I haven't interacted much with Ruby, b…

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
That sucks. I've been doing Ruby full-time since 2014 at 4 companies and I've never seen that sentiment, even from people who really love it. My experiences have been really positive.

Re: Ask HN: Why did Python win?

#547
How about Big Tech and The Cloud? Certainly didn't hurt that the tech giants embraced and helped extend Python. Python's Guido van Rossum has been an employee of both Google and Microsoft (with a stint at Dropbox in between). Visionary Python Foundation sponsors include Google and Meta, while Microsoft and NVIDIA are Sustainability Sponsors, and AWS and Salesforce are Maintaining Sponsors. The Chan-Zuckerberg Foundations is also a big funder and user of the Python ecosystem. For Cloud companies and their big customers, Python's price ($0) is certainly more attractive than commercial software if you need to run software on a sky's-the-limit number of processors.

Re: Ask HN: Why did Python win?

#548

Earlier quoted context omitted.

C++ and Python are not competitors. Sure both are Turing complete so you can implement anything in either. However if you should is a different question. Python is very difficult to maintain when you program goes over 100k lines of code, while the static type system of c++ is good for millions. C++ compiles to fast binary code, while Python is typically 60x slower for logic (though often Python calls a fast algorithm…

As a person who uses C++, I must say something that also applies, somewhat, to Java. We have all the cool kids like Kotlin, Rust, etc. However, when it is about finishing a project, beating C++ or Java ecosystems is almost impossible. Besides that, C++ has improved a lot over time. It still has its warts and knives but you can code very reasonable C++ with a few guidelines and there are also linters, and -Wall -Wextr…

The one thing Rust is getting right that I hope Carbon et. al take from it is using the type system to manage memory.

not having to explicitly remember `free` in safe Rust code is amazing. Knowing that if my types are sound that memory will be managed reasonably is great.

I also think that immutable by default, mutable by explicit declaration is pretty great.

I do think there is a lot of room to add better ergonomics on these ideas however

Re: Ask HN: Why did Python win?

#549
post #332

Earlier quoted context omitted.

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 this is it. Love Ruby as a language. Have grown to hate the way Ruby developers write stuff. Stuff ends up with so much abstraction and indirection. End up yearning for a simpler time when you could write code that just did what you needed it to.

I've seen that in Rails projects too. They're often way more complicated than they need to be.

My rule of thumb is for a medium or large project that one probably shouldn't mess with the dynamic and meta bits of Ruby unless writing a framework and maybe not even then.

Re: Ask HN: Why did Python win?

#550
post #76

Earlier quoted context omitted.

Numpy is certainly amazing, but there are tons of competitors in the data/scientific space, which pure "A-type" data scientists tend to prefer: R, SSPS, Matlab... The difference is that Python doesn't entirely suck as a general-purpose language. Sure, you might have better options, but it's still reasonable to write almost anything in Python. Other scripting languages like Ruby, JS and Lua are probably a little bit b…

I would just add that for scientific scripting Julia is usually nicer to program in than the combo of numpy and Python. Julia is fast enough on its own that you can do the matrix calculations directly and it supports real mathematic matrix operators. It’s also a great type based design that makes using packages magical.

I think Julia has a hard uphill battle against the "Python is the second best language for anything" effect. Julia looks pretty cool to me, but I already know Python. I'll probably learn more about it in my spare time, but I'm also never going to be able to convince my coworkers to try it out, because they also know Python and that's good enough for them. And thus Python's dominance continues.
Post reply on HN