Ask HN: Why did Python win?
578 pointsMy impression is that in the ‘00s, Python and Ruby were both relatively new, dynamically typed, “English-like” languages. And for a while these languages had similar popularity.
Now Ruby is still very much alive; there are plenty of Rails jobs available and exciting things happening with Ruby itself. But Python has become a titan in the last ten years. It has continued to grow exponentially and Ruby has not.
I can guess as to why (Python’s math libraries, numpy and pandas make it appealing to academics; Python is simpler and possibly easier to learn; Rails was so popular that it was synonymous with Ruby) but I wasn’t paying attention at that time. So I’m interested in hearing from some of the older programmers about why Ruby has stalled out and Python has become possibly the most popular programming language (when, in my opinion, Ruby is the better language).
Comments (828) 243 threads
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 app. Since people first learning programming to build a web app would usually start with javascript anyway (since a lot of very first projects might not even need a backend), it was a lot easier for the Nodejs/React route to become the default path. Whereas if you were a data scientist, you started on python, and as you got better, you basically just kept using python.
Well, there's R.
But basically, yes that's the long and short of it.
Also, MatLab was the go-to before Python took over the scene. So it definetely has competitors.
Python's strength is that it is the "jack of all trades" language. Its not the best at anything but its pretty good at everything.
Matlab is closed source. I haven’t touched it since I had a uni license.
Yeah it was a success 20 years in the making, had a fair amount of input from science men and that being GvR’s background he responded positively e.g. the extended slices (striding) and ability to index with an unparenthesised tuple (multidimensional indexing) were very much added for the convenience of numpy’s ancestors.
I would not say it had no competition, Perl used to be quite popular in at least some sci-comp fields (I want to say bioinformatics but I’m probably wrong).
Because I don’t have a great memory and I was never into Perl so I was extremely unsure of the suggestion and didn’t want it to come across as an assertion.
Continue this thread — 1 reply
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 better when evaluated strictly on their merits as programming languages, but they lack the ecosystem.
In other words, it might be inelegant, slow, a mess, whatever, but the concept behind it is basically correct.
I'd immediately throw out "competitors" that cost hundreds of dollars to use. https://www.mathworks.com/pricing-licensing.html Academic pricing is $275/yr and normal is almost a thousand a year. Then you pay for modules on top.
As someone who likes both R and Python, and had the misfortune to learn Stata; I am very glad to see R winning over these expensive dinosaurs. Maybe one day it will even displace matlab!
Continue this thread — 1 reply
Comparing python to R, python feels like a much more mature language. R always seemed only useful for small scale projects, e.g. writing some script to process data with < 20 lines of code. Python codebases just scale much better.
It's not the best way to write analysis code, and it's not the best way to write a web service, but it's probably the best way to write analysis code that runs on a web service.
I picked web services as a random example, not one I'm particularly passionate about. But as a general trend, if you want to combine 2 unrelated domains, Python probably has you covered better or more easily than just about any other language.
Continue this thread — 1 reply
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 usecases well-enough.
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 difference.
> 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 usecases well-enough.
Me neither. *taps sign*
>> The difference is that Python doesn't entirely suck as a general-purpose language.
Continue this thread — 8 replies
Continue this thread — 3 replies
Continue this thread — 3 replies
I don't know what "A-Type" is so I might be misunderstanding you.
For SAS at least in my Org what keeps it entrenched is Enterprise Guide and the associated environment. Having a drag and drop GUI to do the data extraction and manipulation and the analytical tasks makes it very easy for non experts to be incredibly productive. The people that use it here are Engineers (Non-software variety) and Finance accountant types. These people would not be productive writing python code (or R) but still need to use something heavier then excel for data analysis.
Over the years we have chipped away at parts of SAS with things like Power BI and Azure ML Studio but I don't see python playing in the same space.
“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.
Same goes for R/SASS
Python has no competitor in terms of the whole package, it is a full featured language while being particularly good at data
I've done a fair bit of R and there is no doubt that as a pure data science tool it's usually quicker to produce something than Python.
But I prefer Python because inevitably any data science project ends up having other "bits" that aren't pure data science, and Python's super string general purpose computing libraries are hard to beat.
Continue this thread — 4 replies
Continue this thread — 2 more replies
Continue this thread — 27 more replies
> When you're writing working code nearly as fast as you can type and your misstep rate is near zero, it generally means you've achieved mastery of the language. But that didn't make sense, because it was still day one and I was regularly pausing to look up new language and library features!
> This was my first clue that, in Python, I was actually dealing with an exceptionally good design. Most languages have so much friction and awkwardness built into their design that you learn most of their feature set long before your misstep rate drops anywhere near zero. Python was the first general-purpose language I'd ever used that reversed this process.
[1] https://www.linuxjournal.com/article/3882
People decided to wait on doing anything big, since Perl 6 wouldn't be quite compatible. Later it turned out to be extremely incompatible. And Perl 5 would be dead long term, so why spend time on it, when you'd have to do a radical rewrite soon?
Meanwhile, Python was there.
And Perl 6/Raku took 15 years to finally arrive in some form, by which point Python had completely eaten its lunch.
Part of my question is why Python was used as a successor to Perl and not Ruby, but it sounds like Python was established as a competitive scripting language 5 years before people were talking about Ruby.
I can’t find it now, but there was another comment that pointed out that the languages weren’t contemporaries.
Frankly I think language design is secondary to IDE integration. The only time I've ever coded without thinking at all was using Java with IntelliJ or C# with Visual Studio. Type-matching and library introspection all work flawlessly 99% of the time. Not only do I not need to know the details of syntax, but I didn't even need to know APIs because I could autocomplete everything all the time. Python with VS Code still feels stone age by comparison.
I changed companies and learned Python because everyone was raving about it on the Web. I was so confused when I started using it, I thought I had a misconfigured environment or that I was missing some libraries when I started writing Python.
The situation has changed now that having at least somewhat reasonable IDE integration is common. AI tools can also give you pretty good autocomplete.
Well, it isn't intuitive now. It was a lot better than Perl back in 2002 or so, when it really started taking off.
Now, a lot of serious Python code is simply incomprehensible.
const foo = async () => {}
I still have to use python though. I make an effort to type-annotate everything I see, and python's type annotation features keep improving, but it still often feels like an awkward uphill battle
Continue this thread — 4 more replies
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 (still remember c++ boost shipping python binding generator).
Many tools shipped python as an embedded scripting language.
Python was used for creating build systems.
Not to mention any distro out there ships python, it replaced perl in that regard. Batteries included and being available helped it become the norm for random scripting.
Python was big before numpy/ML.
Continue this thread — 28 replies
Because of this, lots of people learned Python, and then applied it in many different areas, and it just became more prevalent and useful.
Continue this thread — 16 replies
All comments shown.
Couldn't load more comments. Check your connection and try again.