Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

221–230 of 856 posts

Re: Ask HN: Why did Python win?

#221

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 JavaScript is just terrible, but there have been millions of new devs who knew nothing else and thought it's fine--better than fine, its great, it's the other stuff that's weird! But then you go on for a while, maybe eventually find lisp and/or functional programming, and you realize how brain-damaged our most commonly used tools really are.

Re: Ask HN: Why did Python win?

#222
post #163

Earlier quoted context omitted.

To add to your comment, the web space was also already very crowded, with PHP, C#/ASP, whatever Java people were using, Django, etc. Rails has always been fairly niche compared to giants like PHP.

People like to hate on PHP (and to be honest I really never enjoyed it), but there was a time when if you wanted to build powerful, large scale websites (or hosting, or scalable web farm deployments) it was the most reliable and performant thing short of Java. It also helped that the PHP ecosystem had some pretty solid and battle tested HTTP components and pretty productive frameworks--server-side rendering with Varn…

The things PHP had that made it win (for a while) was that it was easy to set up and configure for a hosting environment (Apache plus modphp worked out of the box consistently) and the HTML first design made it easy to add to static web pages, whereas forms and CGI was multiple steps and more confusing for less experienced devs.

Re: Ask HN: Why did Python win?

#223

Ruby was never similar in popularity to Python. It was just a fad in webdev circles. I've rarely seen ruby before RoR and I've seen python all over. Python was popular as a teaching language, how it gained a foothold in academia. I remember 20 years ago when I was starting out it was popular for game scripting (Lua was more embeddable but python was also used). plenty of first class interfacing methods to native code…

I'll bite on "just a fad in webdev circles", in case you are serious and not trolling. Railsworld is celebrating the 20th anniversary of Rails this year. As I'm sure you know, Rails is built on Ruby. 20 years does not fit my definition of fad.

I see what you mean, but I counter with Plone. It's been around for 24 years, and the annual Plone Conference is coming up in a couple months. Still, you don't see a whole lot of new Plone sites rolling out these days, and there's no Automattic-scale company with click-here-to-deploy convenience.

Nothing against Plone (although I was very happy to put its foundation layer, Zope, in my rear view mirror). It's a fine program that's very good at what it does. But just because something's been around a while doesn't mean that it's still vibrant and growing.

Re: Ask HN: Why did Python win?

#224
post #188

Earlier quoted context omitted.

> I haven't seen anything an "A-type" data scientist needs in R/SAS/SPSS that was intrinsic to the language Not intrinsic to the language but in terms of the ecosystem, for a purely A-type data science workload R is significantly better. dplyr + ggplot vs. pandas + matplotlib isn't even remotely close. Now, obviously in the real world nothing is ever purely model work, which is why Python more than makes up for the d…

R is great when your data is already together in one place and homogenous/processed. In that instance the workflow using dplyr/ggplot is better. R the language is hot garbage though, and the libraries available for doing random things that aren't working with certain data structures, doing math or plotting are generally much worse than their python equivalents. That is the reason python dominates data engineering, an…

R will still have a solid place in industrial pharma for a long time (even as python growths, R growth will continue. R is pretty tightly intertwined with the process of processing and submitting data from clinical trials to the FDA, much to SAS's chagrin.

Personally I think we have to accept that R, Python, Java, C++, and Go are going to be with us for the rest of our lives. I would expect PHP, Ruby, and Perl to go away much faster. Rust is still in question.

Re: Ask HN: Why did Python win?

#225
post #20

It has very little to do with Python itself. Python won because GvR ran an extremely tight ship. And there were many extremely talented core developers that helped make Python a polished product. The development team made all the right decisions, except for rejecting PEP 355 which was a big mistake. The batteries included approach helped grow the ecosystem. Developers wrote third party libraries in the hopes of them…

> PEP 355 Didn't this eventually become what is now pathlib (which I am a big fan of) ?

pathlib is truly excellent! The overlap with the os library is unfortunate, but I can’t complain.

Re: Ask HN: Why did Python win?

#227
Adding my 2 cents:

Python was not relatively new in the early 00's, but its popularity really started taking off around that time. It is older than Java and Javascript.

Ruby became big primarily because of Ruby on Rails. Python was already big before Django came around. In fact, one of the reasons Django exists is "Python is cool, and we need a good web framework for it".

Why was it already popular? My guesses:

Very easy for new programmers, but enabled you to build fairly powerful stuff with it (unlike, say, BASIC). Eric Raymond, around 2000, wrote an article on why he loved Python, and the main takeaway was that within a day or two of encountering it, he was already building useful scripts with it.

It is fairly well designed (well, at this point it may be overdesigned). A common remark by people learning Python was "I didn't know how to do X, so I guessed and it worked!"

Has some functional programming aspects that appealed to people (e.g. lambdas, map, reduce, filter, etc). Has laziness if needed.

But the real reason: It was not Perl, and was a viable alternative to it. It explicitly was against Perl's philosophy of "There's more than one way to do it."

Batteries included: Every standard Python distribution came with what was then a really good set of libraries. Sure, Perl had CPAN which was more extensive, but consider that not everyone had high speed Internet, and you still have to do the labor of identifying which CPAN package you wanted. For many Python developers, the standard library was all they needed.

Then with NumPy, it became a good alternative to MATLAB. Although started to be heavily used in scientific computation 2006 onwards. With pandas people started abandoning R for it, even though R is, and continues to be, a better statistics language. With Numpy and Pandas available, machine learning easily followed in the early 2010s.

The benefit of Python over stuff like R and MATLAB (and possibly JS) is that you have access to all the other libraries. In those days, if I wanted to write some code in MATLAB, but have it also crawl some web pages, and do some scripting, it was a pain. You'd write the MATLAB code to deal with the computation, and separate scripts for the rest. Now I can do it all in one language/program.

And yes, I'll say it: Whitespace. The lack of braces and semicolons, and the semi-rigidity of whitespace just made it a lot easier to read.

Re: Ask HN: Why did Python win?

#228

Earlier quoted context omitted.

Only one of the items in your "such as" list is unique to python's philosophy, and that is "there should be one way to do it". Ruby embraces the many ways to accomplish something, it's true. However, the three others are not unique to python. Ruby especially embraces "readability counts". And I can't think of anything in the ruby language itself that is implicit over explicit. Perhaps you are thinking of rails and co…

For me, the Ruby community's comfort with monkey patching was a big turn off. In Python, you can hack around on class and replace its methods, but if you do, it's expected that your coworkers might stick you in a dunk tank and sell tickets. It's just not the thing that's done.

Monkeypatching is maybe more of a Rails thing than Ruby. I think the biggest problems with Ruby around the time Python began to take off were slowness (MRI was a disaster, slow, and full of memory leaks), plus patchy documentation (lots of things were in Japanese).

Still, I preferred and prefer Ruby. Python has fantastic libraries, but it is a mediocre language. Ruby feels like a simpler version of Perl + Smalltalk, and it is a joy to use. Python has intentionally crippled anonymous functions plus syntactic whitespace, which often leads to long and ugly code.

I think it is a shame Guido hated functional programming and he did not embrace an Algol-like syntax with begin/do end blocks. Those two things could have vastly improved Python. Ruby's block, procedure and lambda design is a stroke of genius that yields beautiful code and makes DSLs trivial.

Re: Ask HN: Why did Python win?

#229

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…

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

> print f"are you {sure} you need parenthesis to call a function in python"

This example doesn't call any functions. The print statement was removed in Python 3 and turned into a function, so you do need parentheses to call it and the example above is a syntax error. Python 2 (which had a print statement instead of a print function) didn't support f-strings. And f-strings, unlike JavaScript's template strings, are not function calls.

In other words, yes, you consistently use parentheses to call functions in Python.

Re: Ask HN: Why did Python win?

#230

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.

The other strong contender at the time was Tcl, especially when combined with the graphical library as tcl/tk. Python implemented tk as well given it's popularity.

Tcl's extensibility led to expect, which was very useful for automating scripting over telnet.

https://en.wikipedia.org/wiki/Expect

Post reply on HN