Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

451–460 of 856 posts

Re: Ask HN: Why did Python win?

#451
post #122

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…

You're forgetting the period of Ruby's popularity in the devops world, especially Chef and Puppet.

Puppet was just built with Ruby (and later re-written, I think?), in all my years interacting with it I never actually wrote any Ruby.

Chef you obviously had to, but my impression is that the DSL is so extensive you might as well be writing something that's not Ruby.

Maybe this says something about the power of Ruby, but I don't feel like these tools contributed to the language's popularity or ecosystem - definitely not the way RoR did.

Re: Ask HN: Why did Python win?

#452
Serverside Javascript split the vote for fancy web development. Ruby never really diversified meaningfully out of webdev, but Python has always had other major constituencies. There are powerful arguments to do server work in Javascript (single language), and not so much in Ruby, so in the late 2010's Python became the most pragmatic option for non-Javascript serverside web dev.

Another way to say the same thing: Ruby's fate is tied to Rails, and Rails put down a lot of bets that haven't been clear wins, most especially about the relationship between frontend and backend webdev.

I don't think Ruby's going anywhere, though I'd probably default to Flask for a new project. There is a lot of Rails out there.

Re: Ask HN: Why did Python win?

#453
Python got traction earlier and is easier to pick up.

Then it became the new Perl, the glue language to avoid C/C++, that created an ecosystem of reusable libraries: numpy, then panda, then the deep learning stuff.

I started with python in the 2000, it used to be impossible to find job in that language, startups took python as their "unfair advantage" and it grew every year since.

Re: Ask HN: Why did Python win?

#454
Ruby lends itself to a certain kind of "decomposition" or "factoring".

In a functional programming language, you get a "functional decomposition". In an OOP language, you get an "object decomposition". It's what your program structure looks like.

Ruby supports those things, but IMHO provides a sort of "grammar decomposition". Writing programs and libraries in Ruby tend to look like writing new programming languages.

Python tends to produce a "practical decomposition", or a procedural decomposition. Yeah, you can make classes and functions, but actually doing things is valued more than structuring things.

Re: Ask HN: Why did Python win?

#455
Python is only a titan if you include data science. In the web dev world it's dwarfed by Ruby and Node. Some possible reasons are: casual programmers learn python faster, "numpy" is fun to say out loud, and uh, can't think of any more.

Re: Ask HN: Why did Python win?

#456
20+ years ago, Python was popularized as a general purpose programming language, and was used as a systems programming language for tasks that weren't CPU intensive. For tasks that were CPU intensive, systems programmers, who were likely already familiar with C/C++, could easily dip into C/C++ and back into Python again if they needed to.

This made Python a good glue language, and cemented it as convenient scripting language that can be used to do things at near compiled language speeds. This quality made it a good choice for scientific programming, where resource efficiency and language simplicity are valued. In that domain, you could have large datasets that need to be analyzed by researchers who are not developers.

If we go back to late the 2000's and early 2010's, Python was popular as new programmers' first language, while they learned Java/C#/JS/etc for school or work. At that time, some of those languages didn't always have the modern pleasantries they have now. Python very much had the reputation as being "executable pseudocode" in contrast.

You had developers writing a ton of verbose Java, C# and JavaScript at work, but also had a preference for the simplicity of something like Python. You had new developers with Python experience under their belts, as well, as the Python community was/is very focused on helping beginners. When developers come from Spring to something like Flask, it can feel like a breath of fresh air, and it became popular in the web development space as a backend language.

On top of that, Python is older than JS and had a mature library ecosystem. If you needed to write code against an API, use an algorithm or data structure, someone somewhere probably wrote a Python library for it.

As a result, you had a lot of people saying good things about Python, using it in their free time, and contrasting the language with contemporary popular languages.

The data science and ML booms forced organizations to adopt Python if they hadn't in the past so they can work with data and models, and they were incentivized to publish their own Python libraries so that other organizations who adopted Python for the same reasons could integrate their products/services.

Re: Ask HN: Why did Python win?

#457
post #154
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…

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…

> and couldn't be ported to Python

“Couldn’t be” is not the same as “has been”. If R has a package that Python doesn’t, I’m not going to port it to Python, I’m just going to use R.

Re: Ask HN: Why did Python win?

#458
post #384
post #229

Earlier quoted context omitted.

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

> And f-strings, unlike JavaScript's template strings, are not function calls. IIRC, they're syntactic sugar over "string".format(locals())

They're really not, the internals are different, many features were added.

https://docs.python.org/3/library/string.html#format-string-... https://docs.python.org/3/reference/lexical_analysis.html#f-...

Re: Ask HN: Why did Python win?

#459
post #163

Earlier quoted context omitted.

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.

I'd qualify that. A lot of the hype around PHP being easy for cheap web hosting misses the point that a lot of that cheap hosting was configured with PHP as a CGI module, not mod_php. In that sense it was on a level playing field with Perl.
Post reply on HN