Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

311–320 of 856 posts

Re: Ask HN: Why did Python win?

#311
Google used Python; so, a LOT of folks figured that decision was the best one because "Google used it." Google also chose to employ Python's BDFL Guido van Rossum at a key time (2005); which, pushed at least perception of the language forward. Google's support is likely a key factor in the use in data-science, but I don't know the dates/timeline for that as well.

Additionally, during that time the Ruby-core team seemed less focused on performance and more focused on ergonomics. I think the height of this was refinements; which, to my naive understanding were (are?) a real PITA to support/implement for the non-MRI implementations of Ruby. The complexity of the language probably turned off folks who wanted a dynamic language but wanted it to be fast (which is I imagine how all the different implementations of python came about).

Re: Ask HN: Why did Python win?

#312

What concepts does a language force a new user to be aware of, and how reliable are user's first intuitions about those concepts? I would argue that Python dominates Ruby in this metric. New users wonder how to call functions. They form an intuition ("use parenthesis"), but it's unreliable. "Oh, parenthesis are optional--oh, parenthesis are only optional sometimes". New users wonder what a function is exactly. They f…

I'd argue that better relative ergonomics had diddly squat effect on Python's current position. It's first mover advantage, plain and simple. It got its hooks in data science like JavaScript got its in the browser. I can say that personally using Ruby, Python felt like a massive step backward. I can see how others might disagree, but I feel like it's all in what you know first. On a certain level, most of us know Jav…

I'd argue that better relative ergonomics had diddly squat effect on Python's current position.

And you'd be wrong.

I can confidently say that since I fully expecteded python to win over ruby and it did. Every time I used to hear hipsters dev being all the rage about ruby, I knew they implicitly discounted the cognitive load that goes with learning ruby.

The path from pseudo code to working python code was ( is? ) straight forward and ruby doesn't bring anything in term of paradigm over python that justifies foregoing that advantage.

So everytime a bright mind wanted to implement a library in her field of expertise, python was her tool of choice. And that's how python conquered field after field.

Re: Ask HN: Why did Python win?

#313
post #89

Python's old as dirt; it even predates Linux: https://en.wikipedia.org/wiki/History_of_Python Sometimes the key to success is to just be adequate for a really long time.

> Sometimes the key to success is to just be adequate for a really long time.

If that was true I'd be successful by now

Re: Ask HN: Why did Python win?

#314

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 Python was popular as a general-purpose language first. What were their choices though, Perl? It's easy to see why Perl lost out. Other than PHP, I don't really know of any other JIT scripting languages they could have chosen.

You arbitrarily restricted the scope. Java is what I saw.

I was in college 2006 - 2010 in CS, and while all the introductory courses were in Java, by 2008 or so a lot of the other students had switched to Python on their own, for projects where either language would work. Didn't really see anything else, just Java and Python.

Re: Ask HN: Why did Python win?

#315
1) Because it was a better Perl.

2) The single CPU speed was doubling every 18 months almost. Wait a few years, stick the program a new Pentium III or whatever and you got a nice speed boost.

3) Batteries included. It was huge quality of life improvement. Want to traverse directories, parse ini files, send emails, socket programming, even edit audio files —- it was all there.

4) Repl. Huge improvement over other existing popular languages at the time. Especially when ipython came about.

5) No curly braces. People were sick of Java and C++ verbose syntax. They were seen as old and crusty by that time so they wanted something new. “Why do I need 30 lines of code to open and read a file?”.

Re: Ask HN: Why did Python win?

#317

Earlier quoted context omitted.

That was my experience. I like Perl. I'm comfortable with Perl. And after about a day of Python, I never wrote another line of new Perl code. There were so many "it can't possibly be that easy, but it is!" moments. Let's write a function to add five to a number: def add_five(num): return num + 5 OK. So, can I pass that function as an argument to another function? def call(func, value): return func(value) call(add_fiv…

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 {
      return shift() + 5;
  }
  
  sub call {
      my($func, $value) = @_;
      return $func->($value);
  }
  
  print(call(\&addFive, 10));
Why do I have to remember to write `\&addFive` in Perl, when Python doesn't require it? Why do I have to write `$func->($value)` instead of the normal `func($value)` in this case? Why do I have to write `$value` in the first place? That's rhetorical: I know the answers. Still, this was the kind of thing that instantly won me over from Perl to Python. It's not that I could somehow write things in Python that were unwriteable in Perl (or C, or assembler, or ...), but that Python let me concentrate on what I was trying to say instead of how to say it.

In fairness, the equivalent Python code with optional typing is also more verbose than my original, minus the pointer stuff:

  from collections.abc import Callable
  
  def add_five(num: int) -> int:
      return num + 5
  
  def call(func: Callable[[int], int], value: int) -> int:
      return func(value)
  
  print(call(add_five, 10))
The key word there being "optional". Python lets you add that if you want to, but you don't have to. And note that the underlying syntax is identical if you delete the annotations. If you opt in to using them, you don't have to alter the code you're annotating.

Re: Ask HN: Why did Python win?

#318

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)…

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

You're young enough to have never dealt with write-only Perl code ...

Be glad.

Re: Ask HN: Why did Python win?

#319
One reason:

Perl community spent most/all of its capital on the Perl6 debacle.

People waited for years (decades?) for Perl6 to come out. Most moved on (to Python). Perl6 turned out to be a totally different language when it did come out.

Mind you, I love Raku and use it daily but its development did cost Perl mindshare and marketshare.

Re: Ask HN: Why did Python win?

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

>> R, SSPS, Matlab... I'd immediately throw out "competitors" that cost hundreds of dollars to use. https://www.mathworks.com/pricing-licensing.html Academic pricing is $275/yr and normal is almost a thousand a year. Then you pay for modules on top.

Yes, and this is why R has become so dominant in the data and statistics spaces. R is free, and has gained so much momentum that it often has packages that no other language has. Yesterday I found out that there was just no way to easily reproduce mgcv::gam in python. There are loads of similar examples.

As someone who likes both R and Python, and had the misfortune to learn Stata; I am very glad to see R winning over these expensive dinosaurs. Maybe one day it will even displace matlab!

Post reply on HN