Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

641–650 of 856 posts

Re: Ask HN: Why did Python win?

#641

I was there when it happened, I remember it well. Python displaced Perl, when Perl was a dominant scripting language, way back in the 1990s. What motivated people to replace Perl with Python is that we started using scripting languages for serious software with non-trivial complexity. In this context, Python was much more scalable and maintainable language than Perl, it was just an easier scripting language for softw…

> Python was much more scalable and maintainable language than Perl,

This is a really excellent point. We were a Ruby/Golang shop and out of nowhere one of the sales engineers starts writing scripts in Perl. He wrote some really useful stuff, but the downside was that it was incomprehensible gobbldygook baked into 4 or 5 lines, and completely unmaintainable by anyone other than the original author. After he left we decided to rewrite all his code in Python/Ruby based on the general idea of what we wanted the inputs and outputs to be, rather than assign anyone to maintain the actual Perl code.

Vs the 8-year-old analytics/data science codebase I had to unwind a couple years back, was written entirely in Python and was easily understandable from the first line and had been maintained by no less than six people over that time

Re: Ask HN: Why did Python win?

#642

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

I think you're describing a symptom (popularity in data contexts) rather than a cause. If you're looking for causes, https://jeffknupp.com/blog/2017/09/15/python-is-the-fastest-... makes a good case the answer is PEP 3118.

Re: Ask HN: Why did Python win?

#643

Earlier quoted context omitted.

The two are complementary: the built-in `typing` module only provides type annotations , not type checking . Mypy provides the latter, via the type annotations that you (and others) add to Python codebases. Pydantic overlaps with mypy in the sense that it provides a mypy plugin, but otherwise it's just like any other Python library.

So mypy runs "at run time"? I guess that makes sense, I thought the annotations provided some form of checking too, but now I realize that I should really spend some time to inform myself better :').

Mypy runs as a type linter/checker. See https://mypy-lang.org/

Re: Ask HN: Why did Python win?

#645
Python won because it's a good and versatile programming language, in the sense that it can do a lot of things well. AND it's the fastest language to learn, if you know English, because it's the programming language closest to English that we have. Until AI allows us to program in English (or any language for that matter) directly.

I started doing Python 15 years ago for game development (using Pygame) and it was fairly good at it. At least for prototype, side-project games. Coming from C, the syntax wasn't hard to grasp.

Then I tried it for web, coming from PHP. It was good at it too. I could reuse some of what I learnt in the previous step.

Same for AI, now I can dig into it and only learn the AI part. I don't have to learn yet another new language. And it does the job here too.

Python won because it has the least amount of friction at every step.

Re: Ask HN: Why did Python win?

#646
post #426
post #329

Earlier quoted context omitted.

I like Python, but most of the Zen has always been a meme, and not a guideline of design principles of either the language, or software written with it. Besides the one you mention, I also find the "Explicit is better than implicit" line to be against everything Python stands for. The language is chock full of implicit behavior, and strongly encourages writing implicit code. From the dynamically typed nature of the l…

I code both. > explicit over implicit Go was the first language I used that broke an explicit check for nil/null/None. I had to cast my nil to a different kind of nil in order for the program to run correctly. C/Python/Java/C++ didn't have this issue. Null was always null in each of these languages. Further, go panics in surprising ways sometimes. A library developer might decide to panic and cause your program to cr…

> Go was the first language I used that broke an explicit check for nil/null/None. I had to cast my nil to a different kind of nil in order for the program to run correctly.

Maybe I'm reading it wrong, but it reads that you have been accustomed to implicit nil type conversions in other languages and that tripped you up when Go required you to be explicit. It seems Go is the explicit one here.

> A library developer might decide to panic and cause your program to crash

Go is abundantly clear that panics should never cross package boundaries except in exceptional circumstances. And those exceptions should crash your program. An exception means that the programmer made a mistake and the program is now invalid. There is nothing left to do but crash.

It is technically true that a library developer can violate that guidance, but it is strongly encouraged for them to not. The parent did indicate that sometimes the explicitness is only encouraged, not enforced.

Not that Go is some kind of explicitness panacea. It has its own fair share of implicitness. But I'm not sure these two are representative.

Re: Ask HN: Why did Python win?

#647
post #618

Earlier quoted context omitted.

> [...] the perl6 debacle did a lot to convince people that Perl was kind of a dead end. Not GP, but the Python 2 vs 3 holy wars were also something that kept me from adopting Python as a scripting language a couple of years.

Yeah, python 2->3 transition was painful. But, I would argue that was self inflicted. Guido and company chose not to develop a 2.8/2.9/etc series where people could move their code base over incrementally. I mean, I love python, but that sucked! Yes it would have been more work for the devs, but the amount of work it meant for the users were worse. In fact they pretty much just threw away anything before python 3.6 a…

> Guido and company chose not to develop a 2.8/2.9/etc series where people could move their code base over incrementally.

That is literally what 2.7 was, as well as reimplementing some features in later p3 (up to 3.4).

The core team definitely had the wrong transition model at the start, and it took some time for the community to convince them then decide on which items were the most important, but let’s not act like they did not get it in the end.

> In fact they pretty much just threw away anything before python 3.6 anyway now. Many things introduced in the 3.x series before 3.6 just don't work anymore (asyncio syntax being the notable one).

What?

Re: Ask HN: Why did Python win?

#648
post #78

Earlier quoted context omitted.

> Python is very simple making it easy to learn. I would argue that there's little difference between them in ease of learning. I personally found Ruby easier because everything being an object with methods and no free floating functions felt more natural and easier to look up. i.e. string.length over Python len(string)

Ruby has implicit imports which pollute namespaces. This is extremely annoying for anyone who wants to learn the language. It uses extensive monkey patching, which is once again a substantial challenge for a beginner that wants to understand what their code is doing. It has a nicer syntax with procs and lambdas but syntactically distinguishes between them with different ways of invoking functions and all the issues a…

I don't think either of those issues, namespaces and monkey patching, are things that make the language harder to learn. You require a file, the file's namespaces are available. How often do libraries modify your runtime with monkey patches in a way that you'd notice? I'm sure it's come up during my career, but not when I was a beginner. There was a period of time when metaprogramming was more popular in the ruby and rails community but that was some time ago. Still, it's a tool that's nice to have available.

Re: Ask HN: Why did Python win?

#649
post #332

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 this is it. Love Ruby as a language. Have grown to hate the way Ruby developers write stuff. Stuff ends up with so much abstraction and indirection. End up yearning for a simpler time when you could write code that just did what you needed it to.

100%. You can absolutely still just use off-the-shelf Ruby-the-language to get things done, without involving Rails at all, but at this point I think it would be just as weird as using awk or perl for writing a command-line program.

I love tons of things about Ruby, like first-class/syntactic symbols and especially the pervasive and intuitive (in my opinion) use of blocks in the standard library.

Re: Ask HN: Why did Python win?

#650
post #481

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

And this was all despite Python 3 which was, imo, the worst software migration in history

The worst one that succeeded.
Post reply on HN