To quote someone else here, it wasn't the best language, but it was the second best language, and hit the sweet spot for so many domains.
Ask HN: Why did Python win?
281–290 of 856 posts
Re: Ask HN: Why did Python win?
#282Python'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.
> just be adequate for a really long time. Seems to be working for Pepsi, and their killer model of "they don't have Coke, is Pepsi okay?"
Re: Ask HN: Why did Python win?
#283Earlier quoted context omitted.
>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". print f"are you {sure} you need parenthesis to call a function in python" >Python is much more boring in this respect, users are more likely to form accurate intuitions. is defining a class the same as defining a function? What about fun…
Double underscores are ugly, but not surprising or frustrating. I say they are not frustrating because the language doesn't force beginners to be aware of how they work right away. Double-underscore methods are there for people to seek out when they're ready, but the language and the surrounding community doesn't push people into comprehending them. Intuition is good enough for a long time. Ruby has more focus on met…
Re: Ask HN: Why did Python win?
#284There's a joke that is roughly "Python is not the best language for any particular task, but is nearly always the second best language for that task" - it's a jack of all trades language. Because of this, lots of people learned Python, and then applied it in many different areas, and it just became more prevalent and useful.
Python basically solved this problem by wrapping around C code that's far more performant, but still exceptionally simple to leverage due to python's simple syntax. LlamaCpp has C++ in its name, yet its most popular platform is python. So for certain applications, python because the undisputed #1. Because it was C in disguise, with better usability.
With parallelization, Python having 100x slower loops became an old problem. 2023's coding paradigm is "if you're using loops, you're doing it wrong." People love complaining about pandas, but Dask solved all the single-core problems in 2021.
> https://twitter.com/iammemeloper/status/1692901551558320254
Amen
Re: Ask HN: Why did Python win?
#285Re: Ask HN: Why did Python win?
#286Python 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…
Re: Ask HN: Why did Python win?
#287To me Ruby syntax looks too magic. Python is much more simple to understand, a person that doens't know python but another language such as C or Java can write programs in like 10 minutes. The only "strange" thing is the use of indentation for dividing blocks, but it's something you easily learn in 2 minutes. Another thing that helped python is the fact that you can do fairly low-level operations in a very high level…
I will say, my favorite feature of Ruby was the question mark in methods convention.
For those that don't know, a common convention in Ruby was to put a question mark at the end of any method that returns a boolean.
So for example you could write:
if product.active? ... DO THIS THING
It was fun and I enjoyed it. Behind the scenes it was just a method, but the question mark at the end was always fun to me from a readability standpoint.
However, its really not all that different than the pythonic way:
if product.is_active(): ... DO THIS THING
Something about the question mark felt fun and magical.
Re: Ask HN: Why did Python win?
#288Earlier quoted context omitted.
numpy exists (somewhat indirectly) because matlab cost $$$. and now numpy is a far larger use of matlab's concepts than matlab will ever be. I haven't seen anything an "A-type" data scientist needs in R/SAS/SPSS that was intrinsic to the language and couldn't be ported to Python. I don't want a "data/scientific" language, or a "web" language, or a "UI" language- I want one language that explicitly supports all the us…
Matlab has a more interesting dispatch model than python though. (Mathematica has even better dispatch but I haven't used it in almost 20 years at this point) Julia's model is even better, but I just never have time to dig into it deeply enough to get to the zen of Julia. One day when I have time to understand Julia I'd like to, but it's hard to compete with the reliability of python just always working.
Aside: I wasn't a big fan of the Mathematica language so I wrote "PyML" a looooong time ago- it turned unevaluated Python expressions into Mathematica, transmitted them via MathLink to be evaluated the Mathematica kernel, and then the results were send back and converted to a Python expression. This was long before sympy. It never went anywhere (I found ways to simply not depend on Mathematica).
Re: Ask HN: Why did Python win?
#289The majority of Python usage is in data, ML, etc which is really an entirely different use case and discipline.
Re: Ask HN: Why did Python win?
#290Earlier quoted context omitted.
>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.
Python may be JIT now (is it?), but it certainly wasn’t back then.
Here's my reference: