Live data from Hacker News

Ask HN: Why did Python win?

news.ycombinator.com

301–310 of 856 posts

Re: Ask HN: Why did Python win?

#301
Perl5 was king in the 90s and early 2000s for building web apps, and as Perl5 faded, Python was the obvious contender and it took over.

Perl5 was built more for CLI programs and text processing tasks, like Awk. As the internet got bigger, Perl5's idiosyncrasies became more evident. People wanted a cleaner and more structured language that could remain readable in large code bases.

I remember building backends in the late 90s in Perl and yearning for something more structured. Perl5 often just felt so hacky and full of magic, often resulting in unreadable code. When I first saw Python I was struck by how clean and uniform it was compared to Perl5.

Re: Ask HN: Why did Python win?

#302
I've been writing code since the mid-90's, probably in a dozen languages or so over that timespan.

In my experience, Python is "easy" -- as in, you can quickly achieve what you want. It doesn't get in your way with opinions about types or data structures. You can rapidly create horrific kludges that produce the results you want.

Not sure I'd say it's a programmer's language. It's like javascript that way, but without the absurdity and the footguns. It's overall intuitive, and has all kinds of handy shortcuts.

It's interpreted, which means you can futz around and prototype and get things working, hacking at it until it clicks. There's no hang-yourself-in-frustration build chains, nor even the need for reliable and responsible tooling - no overhead at all.

That's the language itself - but it's embedded in an ecosystem of libraries and tools favoured by the data processing / data science community. Given the mad gold rush in the recent years in these domains, it's no puzzle why python is one of the top choices these days.

Re: Ask HN: Why did Python win?

#303
post #283

Earlier quoted context omitted.

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…

A lot of Rubyists are turned off by Python because there are just too many ugly things and exceptions in Python.

100% fair. They're probably right; certainly right from their own subjective view, which is what matters.

I'll also note that the OP focused on how "fun" Ruby was. Ruby is beautiful and fun.

Going back to the original question: why did Python grow more than Ruby? My first answer was going to be a rhetorical question: which beautiful and fun language has been the most successful?

C isn't especially beautiful or fun, not in the same way. (It has a nice minimalism and connection to the hardware maybe.) C++ is beautiful--is a thing that nobody has ever said. Java ain't beautiful. JavaScript, Python, etc, none are especially beautiful or fun.

I think another answer to the OPs question is that beautiful and fun languages are, apparently, not what most people are looking for. Evidently we should not expect a language to succeed because it is beautiful and / or fun.

Re: Ask HN: Why did Python win?

#304
post #31

I first encountered Python around 2000. At the time Perl was more popular in the circles I frequented, and TCL probably about as popular as Python (eggdrop[1] notwitstanding), but Python was growing steadily. I encountered Ruby in the late '00s (as others have noted it made its english-language debut almost a decade after Python started) and Lua was another contender during this time. My memory is that, at least outs…

I think it upset the Perl hegemony in part because of the enterprise infatuation with object orientation. Perl got a lot of flak from the Java/XML crowd (“Perl’s not a real language—it’s not object oriented!”). You could kind of write Java in Python, and thus a certain kind of enterprise techie couldn’t dismiss Python as “just” a scripting language.

That would be similar to saying C isn't a real language while ignoring the existence of C++. Perl 4 wasn't OO, but Perl 5 enthusiastically embraced OO. The first release of Perl 5 was in 1994, whereas Java 1.0 was 1996.

It did take a while for the wider Perl community to embrace OO, though. There were a lot of Perl programmers who weren't into lofty paradigms. Plenty of Perl programmers weren't fully sold on the idea of breaking your program into functions.

Re: Ask HN: Why did Python win?

#305

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

IMO, its not “hilariously wrong” in Python.

Note that as written the priority is that every use case has at least one obvious approach, and that a secondary priority is that there should be a unique obvious approach.

People often seem, however, to misread it as “there should be only one possible way to perform any given task.” Which, yes, is hilariously false for Python, but also not what it says.

Re: Ask HN: Why did Python win?

#307

Python was developed in the late 80's and first released in 1991 - it's been around awhile. One of the things that always made it useful before it became so popular is its great interop with C/C++. Ultimately that interop led to NumPy and SciPy, which allowed you to use a rather simple language and yet get high performance when doing calculations. That, as they say, was that. It doesn't hurt that Python is a multi pa…

i don’t know enough about Ruby, but if it’s true that Python had better C interop early on then roll the clock forward and that should explain an underappreciated amount of the difference.

why are so many Gtk apps written in Python? because `from gi.repository import ` gets you bindings to any gobject C library without extra work for the library authors or the library users. if that sort of thing’s existed for a long time, then yeah: Python’s gonna end up more integrated with the C-heavy computing environment of the era than any language that doesn’t bind so easily.

Re: Ask HN: Why did Python win?

#308

Earlier quoted context omitted.

> There should be one-- and preferably only one --obvious way to do it. This is so hilariously wrong in python though

So I imagine you have that perspective because you started less than 20 years ago. In some ways the idea of the Pythonic Way to do things evolved in opposition to Perl's vigorous advocacy of More Than One Way. Python has been really winning for some time, so it's natural that its ideological discipline has grown ragged. The crop of kids who value options above consistency don't have the scars of the Perl age to infor…

> But Python is -dramatically- better focused, as a community, on finding a Pythonic way to proceed, and then advocating it, than previous cultures.

I would revise that to be that the pythonic culture of one acceptable way to to is better matched with a lot of good development practices.

Perl was also very good at finding a Perl way to proceed. It's just that with Perl that often mean a lot of implicitness and "do what I mean", and multiple ways to do it so you could fit it within your preferred style and tailor it to the current project's needs.

That all sounds good until you are confronted with the flip side of the coin, which is that it's harder to understand when looking at something written with those perspectives for the first time or after a long hiatus from the project, which puts a lot of importance on policy and coding standards which saps effort from just getting something done.

I love Perl, and it's still the language I write most often for work, and it's no great mystery why Python became preferred.

Re: Ask HN: Why did Python win?

#309
You had to choose between python and perl for scripting, so the choice was obvious. However it wasn't considered suitable for any type of complex application at the time (no scripting language was). Ruby wan't really on the radar when python was becoming popular. Also python billed itself as a simple teaching language which attracted a lot of non-programmers who were intimidated by C and Java. It just kind of snowballed from there.

Re: Ask HN: Why did Python win?

#310

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…

Good answer.

Python is, imho, not a very good language. But it has a few great libraries which led to overwhelming momentum and inertia. In a cruel twist of irony those libraries are probably written in C.

Post reply on HN