Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

371–380 of 856 posts

Re: Ask HN: Why did Python win?

#371

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

Yeah. It is now.

It didn't used to be though. People would wax poetically about how pythonic some codebase was and sing the praises of idiomatic python. There was an ideological war between Python ("there should be one--and preferably only one--obvious way to do it") and Perl. ("there's more than one way to do it" or TIMTOWTDI, pronounced "Tim Toady")

Generators and comprehensions and decorators and `functools` are all relatively new.

Re: Ask HN: Why did Python win?

#373
- Python was around long before JavaScript became a thing outside the browser (and yeah, I know it was possible for a while, but let's face it, we needed Node.js and NPM)

- A lack of needing "end" syntax is appealing to many new programmers

- Perl is... yeah.

- Ruby, as beautiful a language as it is, but represents everything wrong with OOP and metaprogramming. Lots of footguns, especially when veering away from basic CRUD with Ruby On Rails.

- Numpy, Scipy, Pandas

- The name "Python" sounds cool. JavaScript sounds like Java, but it has the word "script" in it, implying that it's inferior. Ruby sounds like that girl you had unrequited love for.

- The head start Python had meant that many software packages included a Python runtime for plugins, and there's no reason to change this.

Re: Ask HN: Why did Python win?

#374
Back in 2010, most devs were using Java or C++. As any C++ dev will tell you, setting up 3rd party dependencies takes forever especially on Windows. In comes Python with its simple yet powerful core language features, batteries included philosophy, and tons of easy to install packages. That attracted a lot of attention from C++ and Java devs looking to get things done easier. It also attracted attention from systems developers looking for a saner alternative to writing Bash scripts. Not only that, but because of the simplicity of development, it became a core teaching language for learning programming. And because of all of that, it became even more popular when more math-oriented people needed a language to use for AI/ML.

Ruby fits a lot of the same niches. I also remember experimenting with Ruby at the same time I was experimenting with Python. There's nothing necessarily wrong with Ruby. But it's an either/or situation, like HD-DVD and Blu-Ray. Ruby fell into obscurity almost because of the rise of Python. Because we now have a solid ultra-high level language with batteries included, there's less of a need to also focus on Ruby.

Re: Ask HN: Why did Python win?

#375
post #155

Earlier quoted context omitted.

Ruby has implicit return values for methods, but unless I'm wrong, so does Python.

Python's only implicit return value is the default `None`.

Thanks! Adding that to the things I've learned (or unforgotten, I guess is more accurate)

Re: Ask HN: Why did Python win?

#376
Some notable reasons:

  - Ruby was 4 years younger than Python on the day it was introduced and cites Python as one of it's influences.  
  - It's a fine language but besides rails it wasn't adopted for other uses like Python was.   
  - In the UK at least Django is way more prevalent than rails for web-dev. And if Django doesn't float your boat, there is Flask, FastAPI and others.  
  - Python's 3rd party libs are incredibly wide and many.  
  - It was boosted by Google early on which gave it a stamp of authority.  
  - Schools in the UK teach it to secondary students (high school).  
  - Devices like Raspberry Pi came out with full micro Python support.  
  - There is micro Python.   
  - There is Python in Python (pypy).  
  - There is full windows support  
  - The AI/ML/Data Crowd's darling  
  - It's fast enough for most things and getting faster still.
As someone else mentioned - "win" is not the right term here. Win what? A TShirt? a toaster oven? It's just a matter of adoption in specific geographical areas

(Edited formatting)

Re: Ask HN: Why did Python win?

#377

Earlier quoted context omitted.

> In that space, it had no competitors. Well, there's R. But basically, yes that's the long and short of it.

Or Julia, a language custom designed for data science. Also, MatLab was the go-to before Python took over the scene. So it definetely has competitors. Python's strength is that it is the "jack of all trades" language. Its not the best at anything but its pretty good at everything.

Julia is much younger.

Matlab is closed source. I haven’t touched it since I had a uni license.

Re: Ask HN: Why did Python win?

#378

Earlier quoted context omitted.

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…

Can you explain more about how (you feel) Python is a step backwards? I'm curious if the "steps backward" are syntax level? I feel the Ruby community is very syntax oriented. As evidence of this: I see Ruby developers interested in Elixir and Crystal, languages that are syntactically similar, but technically very different. I do not see Ruby developers interested in Python, even though, if we ignore syntax, Python an…

I really wanted to love Python. As a Ruby programmer I thought Python would be like Ruby, but with a prettier syntax because of the syntactic white space.

Unfortunately this turned out not to be the case. Here's my gripes with Python as a Ruby developer that really wanted to love Python:

There's a bunch of global functions that should have been methods on objects, like `len()`. OO in general seems slapped on later, as evidenced by the weird double underscores, and the explicit this object as first arguments for methods. (OO is core to Ruby and very elegantly implemented imo).

Higher order functional programming is a lot more awkward than you would expect from a scripting language that's generally praised for its data processing qualities. It's nice that function definitions are closures but you can't make them anonymously as function arguments, the reason apparently being that Guido didn't want to complicate the parser. This is a contrast with Ruby's most interesting and unique feature, the do syntax which is a syntactic trick making it really easy to use higher order functions that take a single function as their last argument.

Sort of an aside, but from an interview I read with Guido I understand that he actually regrets making Python have semantic whitespace, he actually doesn't like it. To me the semantic whitespace is one of Python's few redeeming qualities and I just wish Ruby would have adopted it as well. Maybe if it had we'd all be unanimously using Ruby.

Re: Ask HN: Why did Python win?

#379
rails was popular but a very high tower of nominally unique abstractions; coming from perl or PHP and jumping on rails it felt as if rails essentially popularised the generative approach to web infrastructure that is now considered standard (though it existed elsewhere previous and since). For that reason many took it up, but were locked in to its way of doing things, and its problem domain. That is to say, rails programmers were often more interested in CSS and matters of web frontend than backend programming, and thus the surge of programmers it attracted probably did less to bolster the language than they could have. Other groups of programmers who also lept on ruby, such as security enthusiasts, also tended to stick to their corner. In many cases, they were later in the piece - early ruby had many problems with unicode long since solved in PHP, for instance. Ruby felt to me as if it simply never became a cross-pollinating community in the same way other language communities did.

Ruby absolutely has awesome features: lovely syntax, introspection, etc. however people do not use programming languages because of the features but more so the inertia (see: C, FORTRAN, Java...)

Meanwhile, python became popular in universities and the bog standard mechanism by which the publication of a library could be ensured with forward compatibility on many platforms. It was boring, and perfect for boring uses. Most software is boring. To my mind it's really a Java replacement, more so than a ruby/php/perl replacement, or at least spans with confidence enough of Java's traditional market to have a foot in the door for general business deployment of arbitrary projects.

Very much like @NeckbeardHacker's quotable "CentOS in the streets, Gentoo in the sheets." I think python is a business language but few multilingual programmers would really write it just for fun. Experienced programmers seem to get their fun from things like lua, ruby, and whatnot. I don't know why, but syntax is part of it.

Re: Ask HN: Why did Python win?

#380
The best language seldom wins. External factors have a greater influence. Such as JavaScript being the only language available in the browser during the explosion of the web. It was not the best language but in ran in the best place.
Post reply on HN