My 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).
That said, Python was always more popular than Ruby to begin with (more jobs, more programmers, more college CS classes, more books), even in 2000-2010. Ruby was liked, but was only hot because of the Rails connection.
Python is very simple making it easy to learn. Thus, it became more and more popular for fields where programming is not the main task, like science. It is also very easy to extend with C. So, these fields could bolt on time-tested scientific code into their Python scripts.
Ruby seemed to be entirely tied to Rails.
When the 00s and 2010s came with needs for web development and scientific computing for big applications (e.g. ads on social media), there were multiple language options for web development but really only one that made it easy to onboard academics into the task of building software systems.
From there, it was just a feedback loop, and when deep learning became a major field, the ML community was already knees deep in Python, so it was hard to justify making tools elsewhere.
Meanwhile, it seems to me, that Rail's appeal (and with it, Ruby) was taken by Node's promise of using the same language on both server and client, and more generally diluted by the fashion waves of web dev.
If you want to swap Python for another language in scientific computing, you will soon find annoyances that certain packages are missing, or don't talk to each other well, or aren't optimized. If you want to swap Ruby for another language, you just use the other language web dev library and that's it.
As an aside, Julia has been the promised replacement for Python for over a decade. It tries and does replicate the package ecosystem, the ease of use, extendibility, etc. It also goes out of its way to be able to use Python packages out of the box. But it just seems to be very hard to convince practitioners to go to Julia for just some small performance changes.
Then it just snowballed since that time.
They were, but Python is close to 5 years older than Ruby (February 1991 vs December 1995), so in the ‘00s, Python was significantly older than Ruby.
Ruby also was more or less a Japanese-only thing until around 2000. https://en.wikipedia.org/wiki/Ruby_(programming_language)#Ea...:
“In 1999, the first English language mailing list ruby-talk began”
“In September 2000, the first English language book Programming Ruby was printed, which was later freely released to the public“
In contrast, Python was posted on alt.sources from the get-go (https://en.wikipedia.org/wiki/History_of_Python#Early_histor...).
So, effectively, Python had about 9 years head start on Ruby in the English speaking world.
> when, in my opinion, Ruby is the better language
IMO, its flexibility makes it deceptively simple. Certainly, early users used its flexibility a bit too much to implement useful functionality that felt like spooky actions at a distance for newcomers.
And now the era of Textual (https://textual.textualize.io/) is here, python may get the spotlight even more.
Python has honestly had some opportunities to die out (2->3 transition, type hinting missteps, incredibly slow, etc.) but survived because writing extensions was always easy and it was taught a lot in universities.
Yeah, that’s basically why.
Back in its heyday, Ruby had two basic niches. The bigger one was Rails. Rails is still alive today, but after the move towards richer frontends a lot of the hype, and consequently the developers, followed that trend into the JS world. It’s obviously possible to have rich React frontends and Rails backends if you want to, but that isn’t quite what you got with “omakase” Rails.
The other niche was in devops tooling, e.g. Chef and Puppet. But that space moved towards containerization and all of that tooling, more or less, got written in Go.
Ruby's popularity for what it was, was heavily tied to Rails. As that space progressed, a lot of people came to dislike it as much as anything, and maybe more. There are a lot of ways it didn't work so great and those warts made more and more avoid it in future projects.
That's my $.02. I started with JS as well, but in '96 and through classic ASP (JScript and VBScript) through VB6, .Net (and C#) then into/through Node.js etc. I also dabbled in PHP, Ruby and a handful of other tech along the way. Python feels like a massive gap in my knowledge base at times, I have a few books to read, but not much in terms of opportunity/need. And the time I've spent on Python, I feel like I'd rather spend that time leveling up in Rust.
The future of programming is describing the majority of programs in something thats even closer to English, and then fine tuning it with something like python, all of which will result in natively compiled optimal binary.
I'm sure this is less of an issue when you work with it every day and are familiar with it, but I always dread seeing python in the requirements for something because it means the odds of it "just working" are probably not great. Anybody else have this experience?
- The documentation in the Python ecosystem is generally better.
- There's more Python libraries, and they're generally better maintained and better documented.
- Python has a better interface to C.
- Python is more popular and generally more supported by third parties.
- Django/Flask
- There is comparatively little Ruby activity outside of Rails and a few cybersecurity projects.
I really do not like Python. I think it's really inelegant. But it's a better tool for getting my tasks done, due to the above reasons.
For the generation who used matlab in grad school and then abandoned engineering and science to become software engineers, it provided a good soft landing to transfer skills.
The python modules eco-system lead to the stake change. Scikit-learn, Pandas and Numpy made it so useful for visualisation, research, old school modelling ML. Writing and saving files was simple. Making your own module took 2 files with 4 lines of code. How easy.
After establishing use cases in Python 2, which already allowed a lot of C code in practise for speed, Python 3 changed everything with a simpler language that makes it clear what is normal and weird. You might dislike [:-1] at first, but you definitely know it's weird compared to other languages, so you can know what to search for. Not true of abstractions in some other languages like Ruby, for migrating devs.
Then Python caught with Tensorflow/PyTorch a real wave of being the place to go. Kaggle involved 100,000s all coding in Python for data science in the latter half of the 10s. It did this at the same time as the LAMP stack and LAMP pre-installed VPS running cPanel were dying to React/node.js and PaaS approaches on the one hand, and big cloud providers on the other. So suddenly, there was not an easy default 'nix environment with PHP to rely on being available so easily, and adding python to an existing server is super easy (and Flask/Django easy to grep), making adding a backend for ML or whatever, very easy too. Ruby wasn't even on the playing field for many of these use cases.
I think a last small impact was that Ruby was misused where shell scripts could have worked. Many people made Ruby cli tools for their internal team, when shell scripts would have been fine - this frustrated some of their peers away from Ruby. There is no difference from Python here, but I just noticed it more.
And then lots of things were built on top of Numpy - image processing, reading GIS raster data, scipy, pandas, etc etc - and they're all trivial to combine because it's all just Numpy arrays.
Python also had a very friendly and approachable community from the start, and great docs, while Ruby had its documentation in Japanese only for some time.
Django is also top quality, imo. Similar to Rails. But it always seemed Ruby was only good for Rails, whereas Python combines with everything.
So as usual, it's not about the language, it's about the rest.
Ruby is too different; too many symbols and idiosyncrasies inherited from Perl, Smalltalk, and created by itself.
That is the root reason why they diverged and Python ended up with the scientific ecosystem.
This is further evidenced by Ruby’s popularity only shooting up with Rails, when 2005 web 2.0 attracted lots of non-CS people to come into the field with no prior C-based experience, so they learned Ruby, html, and css fresh.
My memory is that, at least outside of the web/RoR world, Ruby at no point as popular in the US as Python. Lets take, say 2005 as a point that Ruby was really gaining popularity due to Rails: at this point I was already seeing internal tools that previously would have been written in Perl being written in Python.
Python just seems to have maintained a certain momentum, and I'm not sure why, but if I had to guess:
1. The syntax is almost a dead-ringer for pseudo code. The first time I encountered Python, I fixed a bug in an open-source project having never seen Python before. I recall two different CS programs switched to Python from Scheme for exactly this reason.
2. It was designed to glue C together. Other languages were too (TCL and Lua; Perl primarily interfaced with the outside world in the same way shell does, with pipes).
3. A kitchen-sink approach to the standard library helped it a lot for the first 20 years of its existence. CPAN was sui-generis at the time for installing libraries, so the more you could do without relying on 3rd-party libraries, better off you were.
But I'll add Ruby on Rails and a lessor extent Ruby was pushed by hipsters hard and people who didn't program but were internet explorers.
Python just was. You'd never have not considered it a language.
I always thought having Python 2 and 3 held it back a decade. The fact it won despite that means to me it was never a contest.
People care delivering features rather than design and build the best in class architecture.
I wish javascript adopt the same python philosophy, rather the actual "spaghetti mess".
The main thing that has led to the decline of Rails is the rise of no-HTML-just-an-API backends. Your web frontend development stack is more likely nowadays to be, first you pick between React or a similar framework, and then the backend just sends API data and doesn't mess with HTML. This makes for better websites, and it makes joint web and mobile development easier too, because you're going to have to build that API anyway for your mobile app.
Unfortunately Python has a lot more colons than it used to, and has gotten less readable recently.
Perl: could not stand the syntax or the language philosophy
C++: too many footguns
TCL: a bit primitive for what I wanted to do
Java: ugh. just ugh.
Go: not targeted at my use cases
Cross platform and the ease of integrating to other codebases (both extension and embedding) are two parts. Perl's transition to Perl 6 seemed to hurt/fragment that community more so than python 2000 did to python. TCL seemed to slowly die except for a couple niche applications - possibly expedited by Sun's slow demise. Guile never really ran well on non-*nix systems.
Fundamentally python had more C/pascal flavor than Ruby's smalltalk's flavor. That made it easy to teach/adopt. A couple big name universities moving from scheme to python for intro CS helped too.
I'd argue numpy/pandas are so fundamentally different from base python that you need experience in those as well.
Ruby could have been a contender but still had some of the “there is more than one way to do things” left over from perl(ruby was kind of an pragmatic alternative to the “real soon newer” of perl6) and it’s a bit more dynamic than python in how it handles variable internally.
And the field of academic data crunching was hurting badly from the fact that the two only viable options for most entry level researches was Excel/VisualBasic or PERL so everyone wanted some level of structure which the python community led by Guido provided, once people begun to settle on bumpy and pandas.
And pythons popularity definitely grows from the fact that it’s what non programmers learned as an alternative to Excel/SPSS/SAS/Matlab(all of whom are expensive proprietary tools) in classes focused on analyzing data.
The prize for greatest number of incompatible versions?
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.
Given the choice between Perl and Python, I think it's clear why the latter won out.
Also Perl dropped the ball with Perl 6.
Granted most interpreted languages are, but ruby startup time last I checked was at least 30% more than python.
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 is not the best at most things but a close second or third usually (system scripting, data munging, web programming etc), meaning it is easy to get into the language for one use, then continue using it for other things.
Ruby or Go feel like something that ended up specializing in web, so even if they are better suited to it than Python, Python benefits from more cross-pollination.
This will be especially true for small teams, where one language has to cover all bases, and also where "areas" of programming overlap. Need a REST server to serve up MP model results? By virtue of being pretty close to best for both areas, it is actually possibly the top choice overall.
Because of this, lots of people learned Python, and then applied it in many different areas, and it just became more prevalent and useful.
Although I'm a proficient JavaScript programmer now, the idea of curly brackets were genuinely intimidating. Just something about that made the program seem more complex than necessary, and Python seemed really clean.
I also think the book `How to Think Like a Computer Scientist` is a large part of Python's success for beginners. In the early days, it was literally the only programming learning book that clicked for me, and it was in Python. Up until then, programming still felt esoteric.
> 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.
ruby does one thing very well
So apparently the "do one thing well" thingy doesn't always hold
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 paradigm language - unlike many of the other popular languages today demanding a particular mindset for programming. You want to do structural programming? Fine. Object-oriented? That's fine too. A little bit of functional (lite)? There's some limited capabilities for that too.
Add in 30 years of Java JIT compilation optimizations that's been applied to Python interpreted code, C/C++ interop - Python is a simple, yet powerful language. That's why it's become so popular.
Sometimes the key to success is to just be adequate for a really long time.
Ruby's poor performance hobbles it even in places it's supposed to be good (twitter was rewritten to Scala over rails).
Meanwhile, python ended up being the default programming language taught to domain experts in a ton of different domains. Having your engineers write the same programming language as your domain experts turns out to be really useful for business. Using NodeJS as your backend if you consider web your domain is also an excellent choice and also eats into Rails' market share.
I have seen some shops with modern rails deployments do truly awesome stuff, but it's hard to beat being able to take a script an analyst has written, hit it with a linter, and throw it into your production application.
Also, for what it's worth, the python 2/3 debacle was a much bigger deal back in the height of Rails' popularity. I was genuinely worried that the schism would continue to haunt the community; that someone would fork 2.x and we'd have two competing pythons. That didn't happen thankfully.
I found it really easy to adopt and use as a non-programmer. I ran out of rows in my excel spreadsheet, and needed something that would ingest my spreadsheet quickly. It took me one line of code to import, and then one line to export.
I was quickly off to the races with deep data analysis and felt it worked so much better than excel as the calculations were more readable and reproducible.
I learned Ruby for Ruby on Rails before this, but it just isn't as quick and easy.
This made it fairly easy for anyone to provide Python bindings for existing C libraries, so users could enjoy a large number of packages in order to get stuff done quickly.
Then of course, numpy/pandas etc.
what i posted/suggested then was something in the lines "how to make Python not to be next Java, i.e. turn into carreer-language". of course nobody noticed.
Well, seems python did become next java. kind-a. i cannot decide is it good or bad.
The ability of python to integrate with C/C++ code went a long way to making it a long term viable platform. If you needed scripting you could code in regular python. If you needed advanced control of hardware in your scripts, you could write a python extension in C/C++ to gain access to that hardware. If you needed high performance, or high parallelism, you could likewise create an extension to solve those problems.
In this way Python was the best of both worlds. Elegant scripting which could be combined with blazing performance and low level hardware interfaces. This aspect of the language allowed it to have a wide footprint (as opposed to just the browser) and to leverage legacy libraries effectively - e.g. BLAS.
I personally did crazy stuff like: "embed a python interpreter in a C program, to use python scripting within the program" back in like 1999.
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 form an intuition, but their initial intuition doesn't encompass all 7 different types of callables in Ruby, so many surprises await.
Python is much more boring in this respect, users are more likely to form accurate intuitions.
This is my opinion as someone who likes Python but hates Ruby. I learned Python in the mid 2000's while trying to script Asterisk. Asterisk had an existing community around PHP and Ruby, so I looked at Python, PHP, and Ruby, Python appealed to me most. I remember being very confused about what Ruby "gems" were, I thought they were something like "JavaEE" that I'd heard about in passing at school, some kind of compiler plugins or something complicated. Python had "libraries" though, I knew what they were. These were my experiences as a new developer giving both languages a fresh look.
I don't like Python but I'm getting paid almost a decade working with it everyday and... it is good enough.
You can look back at some things that occured and say "well it's because it's easy" or whatever, but to be rigourous you'd have to also apply that to the languages that _didn't_ win, and the reasons that they didn't win to Python, and at best there's loose correlation.
This is the same as people that point to "why" billionaires are billionaires. There's a whole lot of luck to it that you can't discount.
Further, I'd question the premise. It's clearly the first thing that people reach for in ML and in the top 3 for web backends. But it hasn't always been that way and it won't always be. Programmers have way too much ADD and contrarianism for any such state of affairs to last for long. And in other spaces and even in other social circles it would be unheard of.
By contrast I feel Ruby was very much a one hit wonder with Ruby on Rails.
I don't think we're going to be talking about languages winning any competitions soon, once we're generating programs with natural language. Natural language is going to win the competition in the long run.
That changed very fast once deep learning arrived on the scene. Plus the Python ecosystem kept getting better. Google/tensorflow/python was the final nail in the coffin, and the ecosystem had irreversibly shifted to Python.
But the reason I stuck with it was quick turnaround and solid, maintainable code.
When I was at a local ISP/Yahoo-style portal in the 2010s, it was fashionable to run our own music and storage services. One of our teams implemented a Dropbox clone (called MEO Cloud) that was API-compatible (and had a Python client that I helped test).
At that time, we had a resident music streaming service that had a massive storage array on-premises, and we had a branded music streaming app to go with it. We wanted to implement a Shazam-like functionality, so I borrowed two big multicore Xeons, built an audio fingerprint indexer fot it based on a (now defunct) OSS library, and indexed the entire thing (some hundred million audio files) with Celery. It took me 3 days to write the first version, and two more to tweak things (fingerprinting was done in C++, and the only real constraint was datacenter network).
At that time we had a lousy experience with Rails and Ruby. I was using Basecamp and was interested in it (plus I wrote quite a bit of Ruby for Vagrant and Puppet), but the people we hired to do two or three Rails projects never managed to deliver anything usable or maintainable (since we were mostly a PHP/Java shop when it came to front-ends, reliability and scalability were paramount, and gems were hell to deploy and troubleshoot at the time).
I moved to Python 3 with minimal hassle (perhaps because I took great care in the dependencies I picked), adopted asyncio to great effect (I use my own asyncio code to batch writes to Azure storage these days), and all the while it has remained a very enjoyable, readable language (except when I come across poorly written OOP code that reads like Java fanfic).
My own coding style is closer to LISP/functional programming (I am actually refactoring a piece of code I wrote eight years ago in Hylang, the perennially under construction LISP-equivalent), and I love virtualenvs, the AST, the way I can use decorators to modify code behaviour, and, of course, the fact that today I can run and work in it everywhere (I have multiple interpreters on the iPad, for instance).
I could go on, but I've essentially been using Python as a mix of C/C++ glue, some fairly involved functional programming and a lot of multi-processing and concurrent code (I tend to push the interpreter to the limit when I can't use Cython). And I even wrote my own PasS on 1500 lines of it: https://github.com/piku (which I still use today).
From where I'm sitting, Python won because it is a great, maintainable glue language with some pretty much rock solid libraries (not just the standard library). Bottle and Django come to mind, although these days I'm more into aiohttp.
At the same time, Python was a pretty early adopter for the server backend (and stuff like Zope existed) and also had great interopt with databases but PHP was a stong contender/#1. I'd say Rails timing was off by a bit or Ruby would have gotten more momentum (at that time there were already many things in Python land to compete like Django etc.). Meanwhile JS was still pretty cludgy to use and required a lot of hoops just to set up an environemnt and things like node came a bit late as well or JS would have taken more "web backend marketshare" from Python immediately. There was a window when the Python 2->3 transition slowed things down (imo) but overall it went slow but smooth for such a big transition.
Python was also an early player in other niches like security (both scripting and tooling).
And when ML happened to take off (grossly simplified) once again Python was there as an early player with good tooling and support for most things and with excellent ties to scientific computing.
It also got good support early from some key players, most noteably Google.
So basically, Python was always there when it mattered and "good enough", came with "batteries included" and the Python community has always been great + willing to quickly get working tooling and libraries in all relevant areas. Importantly Python has always been beginner friendly enough to attract a decent chunk of non programmer specialists from other fields that used it to dive into programming (scientific computing in general but biology comes to mind as a typical use case).
I can’t say much about ruby, barely used it, but if I were you I will look at Go, it’s definitely better than Ruby and still ahead in terms of performance, not the top one but for its easy of use, it is probably the best choice.
If you wanted to do something there was probably already a Python lib for it. Nothing else had such a rich library ecosystem. If you really need python to perform it is usually easy enough to write the needed routines in a lower level language link it in.
Python grew because it was so easy and powerful enough. Now that python loads are getting into substantial computing the efficiency is becoming an issue.
I don't know why Python has outshined its contemporaries like Perl, PHP, Java and Ruby. It has done a great job, and there is probably much to be admired.
Python is good enough at everything.
Also does not hurt that it was designed as a teaching language at first. Nowadays reading some of the code that is out there I feel like I have no idea what is going on. Type hints and that way some libraries use it makes my head spin sometimes...
Ruby was an unknown till the RoR was introduced. And the reason why RoR was so easy and popular, was Ruby's biggest shortfall - excessive metaprogramming. The automated creation of all of the CRUD operations was definitely a kick in the... of Java and many other languages that lacked such ability. But that comes with all of the readability downsides, when "programming by convention" lacks a commonly understood convention. (Scala also suffers from it, just that Spark works so well for majority of it's use cases)
The worst part for Ruby, was that none of the features that RoR brought were hard to implement in other languages. Others caught up and Ruby didn't get enough windfall to keep sailing.
Then there was the community, that RoR attracted in the early days... the best way to describe it was - toxic.
> how fun and easy to use it is
First impressions are deceptive. When RoR was getting popular, many people who said the same typically showed me an example of some functionality implemented in just one line. Which is not exactly a great case for a programming language.
As for Python - it just grew steadily. Building the fundamentals and spreading. Having strong opinions from a single person made Python very easy to read and understand. It's by far the easiest popular language to use to demonstrate concepts to anyone - there's a very gentle learning curve. The community, tooling and documentation - are considerably better than Ruby's.
Remember that there are really beautiful expressive languages that make people fall in love with... but syntax is just one small part of it.
As for why it beat our Ruby; in those early days Python tended to win the performance comparisons. That led to people using it for more demanding data tasks, which in turn led to more libraries for those sorts of domains. The parallel growth of jobs demanding those capabilities (data analytic and AI), cemented its supremacy.
That all said, if I need to hack a script together to automate some development task - in the vein of what Hunt and Thomas described back in 1999, I still reach for Ruby.
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.
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.
I believe that Python gained popularity among scientists for the same reason. They needed a simple programming language, not because they lacked brainpower, but because their job was to focus their intelligence on the scientific problems they were solving, not on programming. Writing code was necessary but not meaningful in itself, like washing beakers or feeding lab rats. The less effort it took, the better.
For people like that, Python won because they were able to become productive with it while learning very little about it. Also, it was rare to accidentally write Python code that was hard to read. This was especially important for scientists, who didn't have a software engineer's appreciation of the difficulty of reading code and the need to practice restraint when writing it.
Also, python predated ruby by several years. Python 1.5.2, which is about the earliest version that resembles modern Python, was release in early 1998. The first Dnglish language book on Ruby didn’t come out until late 2000.
Being default on linux helped python succeed, not anything specific about the language. It became default on Linux because it was better than perl or bash (easier to use and manage deps) and had decent upstream support and an ecosystem around since the 90s.
On windows powershell is still king, python shares the throne as a close second though. Compare all that import-module, nuget, winget, chocolatey,etc... mess with pip! And version nightmares are more manageable thanks to pyenv. Python ecosystem is good at making a mess work well (except when it doesn't).
Just look at this article by Paul Graham, written in 2004, called "The Python Paradox" http://www.paulgraham.com/pypar.html:
> I didn't mean by this that Java programmers are dumb. I meant that Python programmers are smart. It's a lot of work to learn a new programming language. And people don't learn Python because it will get them a job; they learn it because they genuinely like to program and aren't satisfied with the languages they already know.
> Which makes them exactly the kind of programmers companies should want to hire.
This was written more or less at the same time that Ruby on Rails was first released. Clearly by then, people had known about Python for a while.
That head-start led it to be more popular early on, except in webdev circles specifically. But in the other circles, and especially in Academia, Python was gaining popularity, which helped it both get lots of great scientific libraries (making it today's default "data" language), and also made it eventually become a language taught in Universities.
To quote someone else here, it wasn't the best language, but it was the second best language, and hit the sweet spot for so many domains.
Another thing that helped python is the fact that you can do fairly low-level operations in a very high level language. Python gives you os-level API/system calls that otherwise you would need to use a language like C to have access to. This makes python great to do system programming: indeed a lot of system tools in Linux where performance is not critical are written in python. For this reason you can assume any Linux/UNIX system has a python interpreter, and thus a lot of scripts and tools started to be written in python.
It's also quite easy to call C code from python code, and vice versa (for this reason python is used as a scripts/plugin engine in programs written in other languages). This is the reason a lot of scientific calculation tools are written in python, since they have the algorithms implemented in C for maximum performance with a python API to be able to be used easily.
BTW, if you enjoy Ruby, watch this: https://www.youtube.com/watch?v=eGaKZBr0ga4&t=705s
concrete example:
python:
foo.py:
def f():
...
bar.py:
import foo
x = foo.f() # very clear where f comes from, just look up foo.py
ruby: foo.rb
def f
...
bar.rb
require 'foo'
x = f # grep through the code if you want to know what f is
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.
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.
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.
I learned Python first. I saw Ruby as a "similar language, faster, more syntax-heavy, popular in Japan".
Python "won" because of Guido's focus on ease of use by non-programmers. A bunch of scientists used it to steer long-running computations in C, by binding the fast C math libraries with a Python frontend. Python was so easy to use that new scientists and interns could get started easily.
I don't know why Ruby has stalled out. Its "test first" culture and of course Ruby on Rails, and Chef, are all excellent.
When I opened the book, unlike java or js, I could just read the code. Like... I could just read it and already understood what was happening. I already knew way, way more logic than would ever need. I think it took me about a day to figure out object-orientation, but it was trivial. I went from not knowing how to program, to being able to run fizz buzz in like a day, and do it with objects in like three. Other languages are so caught up in so much bullshit technical stuff I still can't stand them.
Python is intuitive. It's approachable. I focuses on getting you from zero-to-code over a bunch of much more technical applications. Python is the party that welcomes you in, instead of checking your ticket at the door.
As a non-CS person who has fallen in love with programming, I honestly never want to learn another language if I don't have to.
The majority of Python usage is in data, ML, etc which is really an entirely different use case and discipline.
Python has a lot of native things like list dict sort join etc, you need library much less often your code gets very very short.
Python has some functional programming in it, which makes it even more flexible than C++ in my view.
Python is just so readable with its indentation style, very few language do it like this. I even started to make a C-ish language with indent-style scoping, it's a bit difficult but I did it.
Even if it's one of the slowest language out there, it's so good and simple that you realize that what matters is not the language speed, but what matters is what you write. A good and fast software must be well designed first, the language choice comes second.
Python is VERY OFTEN the best choice because its simplicity lets you write better software more easily, so in my view, a language like python allows programmers to write better software.
Programming language philosophy matters.
2) The single CPU speed was doubling every 18 months almost. Wait a few years, stick the program a new Pentium III or whatever and you got a nice speed boost.
3) Batteries included. It was huge quality of life improvement. Want to traverse directories, parse ini files, send emails, socket programming, even edit audio files —- it was all there.
4) Repl. Huge improvement over other existing popular languages at the time. Especially when ipython came about.
5) No curly braces. People were sick of Java and C++ verbose syntax. They were seen as old and crusty by that time so they wanted something new. “Why do I need 30 lines of code to open and read a file?”.
Perl community spent most/all of its capital on the Perl6 debacle.
People waited for years (decades?) for Perl6 to come out. Most moved on (to Python). Perl6 turned out to be a totally different language when it did come out.
Mind you, I love Raku and use it daily but its development did cost Perl mindshare and marketshare.
Additionally, during that time the Ruby-core team seemed less focused on performance and more focused on ergonomics. I think the height of this was refinements; which, to my naive understanding were (are?) a real PITA to support/implement for the non-MRI implementations of Ruby. The complexity of the language probably turned off folks who wanted a dynamic language but wanted it to be fast (which is I imagine how all the different implementations of python came about).
Ruby essentially stole the thunder from Perl and PHP as the language for back-end development with Rails. But with Django, Python pretty quickly had a more or less equivalent web framework.
Here's my recounting of history:
- For about a decade, Rails remained one step ahead on the cutting edge of web development. Thought leaders like 37 Signals / Basecamp constantly rolled out innovations through Rails, appealing to the most forward-thinking web devs. But Python was never far behind.
- I would also argue that Python is an easier to understand language. Ruby encouraged the development of DSLs with its second-class functions / block syntax, but Python tried hard to keep its core language simple and emphasized explicitness.
- Meanwhile, the simplicity of Python's syntax made it very appealing for developing data tooling, competing with a bunch of expensive proprietary tools, like MATLAB. This exploded Python's userbase.
During this period, I would say Ruby was the hotter language for startups, but Python had a bigger userbase, as the more middle-brow option.
Starting around 2015, both languages started to see other languages encroach on their web dev moat. Node was better suited for simple microservice APIs. People got into typed programming for its perceived advantages. Compiled languages took on a lot of the high-performance systems.
Every time I have to touch Python to mess around with anything going on in the ML space, it just feels so clunky, in ways that Ruby feels like it wouldn’t have trouble with.
I think r_thanbapillai’s top level comment is spot on. Ruby became a “web” language because of the singular focus on Rails (at least in the west) which hampered its growth in other areas. It’s not so much the language that makes a community but the libraries people are inspired to build with it. Python specialized in the “right” thing for its moment in the sun.
I do think we're slowly seeing Julia or other more purpose built tools slowly eating python’s numpy lunch.
> Ruby has clever syntax. Python has pure syntax.
> Ruby has method aliases. Python does not allow a string to capitalize itself.
> Ruby uses Ruby methods within Ruby classes to extend Ruby. Python has decorators so you can write functions that return functions that return functions to create a new function.
> Ruby has strict object-oriented encapsulation. Python is laid-back about objects, because you probably know what's going on inside them anyway.
> Ruby lets you leave off parentheses so you don't miss objects having attributes too much. Python will let you mix tabs and spaces for indentation, but passive-aggressively mess up your scoping as punishment.
> Ruby has seven kinds of closures. Python has one, in the unlikely case a list comprehension won't do.
> Ruby's C implementation is a mess of support for language-level flexibility. Python's C implementation is so clean you get the unsettling thought that you could probably write Python using C macros.
> Ruby supports metaprogramming for cases when programmers find it more descriptive. Python supports metaprogramming for cases when programmers find it necessary.
> Ruby is expressive. Python is direct.
> Ruby is English. Python is Esperanto.
> Ruby is verse. Python is prose.
> Ruby is beautiful. Python is useful.
> I like Python, but coming to it after using Ruby for seven years, well, I think it's like dog people and cat people. You can like having one species around, but you're always thinking -- why they can't be more like the other?
-- This is one of my favorite HN comments of all time: https://news.ycombinator.com/item?id=682364
Like you, but you're in not the majority.
Ruby fits a lot of the same niches. I also remember experimenting with Ruby at the same time I was experimenting with Python. But it's an either/or situation, like HD-DVD and Blu-Ray. Ruby fell into obscurity almost because of the rise of Python. Because we now have a solid ultra-high level language with batteries included, there's less of a need to also focus on Ruby.
- A lack of needing "end" syntax is appealing to many new programmers
- Perl is... yeah.
- Ruby, as beautiful a language as it is, but represents everything wrong with OOP and metaprogramming. Lots of footguns, especially when veering away from basic CRUD with Ruby On Rails.
- Numpy, Scipy, Pandas
- The name "Python" sounds cool. JavaScript sounds like Java, but it has the word "script" in it, implying that it's inferior. Ruby sounds like that girl you had unrequited love for.
- The head start Python had meant that many software packages included a Python runtime for plugins, and there's no reason to change this.
Ruby on Rails was very big at the time, but I ended up choosing Python for a couple reasons. Python was a bit older, it already had a reputation as a scripting language for system administration. It had more libraries like Numpy and seemed like you could do more things with Python. You could script, write desktop apps, use it for data science, while Ruby was pretty much just for web dev.
Even back then there was a huge ecosystem of Python package and it seemed like anything you wanted to do with Python, there was already a decent library available for it. So it seemed like you had more options learning Python. Django was also just coming out at the time, so you could do web dev with Python too. Then Reddit rewrote their site and switched from Common Lisp to Python, so that seemed like a good endorsement too.
Python became as big as it has because Machine Learning / AI exploded and Python was there to benefit from that. Numpy / Pandas / Jupyter Notebooks etc. gave everyone who wanted to learn ML/AI FREE tools that were as good or better than Matlab / Mathematica / SPSS or other software that cost thousands of dollars. Grad students are poor. Maybe their school has a Matlab license they can use, but they probably can't install it on their personal laptop, so they used Python instead, wrote all of the influential papers about ML using Python, then anyone else who wanted to learn from that installed Python and so it goes.
https://docs.python.org/3/library/optparse.html
https://ruby-doc.org/stdlib-2.7.1/libdoc/optparse/rdoc/index...
I learned Python 2.3 almost 20 year ago, and the standard library documentation in Python has always been just as good. As a beginner I found Python's documentation very helpful, I could read the documentation like a tutorial, like a book, a good teacher. To this day I still look at the Python regular expression documentation whenever I'm using a regular expression in any language. I learned regular expressions from the Python documentation, there was literally no blog or tutorial I found more approachable than the Python documentation when I was very first learning regular expressions.
Ruby had, and still has, a list of methods for documentation.
Ruby (outside of Japan, where I understand this has not always been the case) has its popularity almost entirely tied to Rails, Python was much broader, and its resurgence with AI/ML is largely because of its excellent scientific stack which has been around for a long time but people outside of that space often ignored, but which makes it an unequaled high-level glue language in that space.
TL;DW: The presenter mentions that Python experienced a slow but consistent growth trend, leading to its current prominence. Other points he highlighted about its success align with much of the sentiment expressed here.
While the friction of installation isn't the sole reason why Ruby isn't as popular as Python, it did leave a bad impression on many devs as they shifted their projects to PHP.
They loved it so much that they made homework-solving numerical libraries. They turned into numpy.
At some point, almost every undergraduate and most of finance industry was churning python. Python 3 was released. People hated that. Microsoft was interested. Guido started following modern languages. Asyncio was buggy. Pandas was built. Django was jealous of Rails. Not much happened for a while. AI! CNNs! Deep neural networks! Alpha go beat everyone. Tensorflow! Suddenly everyone did pip install. Cuda, pytorch. Ruby got left behind. Asyncio got fixed.
Python is not great at anything really, Numpy is good because uses C code, PIP is crap, the stdlib has 0 consistancy, types are comments, you have to learn venv, etc... But Python is everywhere, it is in the web dev, devops, data. And now is even in the browser, Excel, rpi, etc... so learning python means you can do anything anywhere.
- Ruby was 4 years younger than Python on the day it was introduced and cites Python as one of it's influences.
- It's a fine language but besides rails it wasn't adopted for other uses like Python was.
- In the UK at least Django is way more prevalent than rails for web-dev. And if Django doesn't float your boat, there is Flask, FastAPI and others.
- Python's 3rd party libs are incredibly wide and many.
- It was boosted by Google early on which gave it a stamp of authority.
- Schools in the UK teach it to secondary students (high school).
- Devices like Raspberry Pi came out with full micro Python support.
- There is micro Python.
- There is Python in Python (pypy).
- There is full windows support
- The AI/ML/Data Crowd's darling
- It's fast enough for most things and getting faster still.
As someone else mentioned - "win" is not the right term here. Win what? A TShirt? a toaster oven? It's just a matter of adoption in specific geographical areas(Edited formatting)
Ruby absolutely has awesome features: lovely syntax, introspection, etc. however people do not use programming languages because of the features but more so the inertia (see: C, FORTRAN, Java...)
Meanwhile, python became popular in universities and the bog standard mechanism by which the publication of a library could be ensured with forward compatibility on many platforms. It was boring, and perfect for boring uses. Most software is boring. To my mind it's really a Java replacement, more so than a ruby/php/perl replacement, or at least spans with confidence enough of Java's traditional market to have a foot in the door for general business deployment of arbitrary projects.
Very much like @NeckbeardHacker's quotable "CentOS in the streets, Gentoo in the sheets." I think python is a business language but few multilingual programmers would really write it just for fun. Experienced programmers seem to get their fun from things like lua, ruby, and whatnot. I don't know why, but syntax is part of it.
While I appreciate we love to try and explain the present as an inevitable destination, some times it's just the way the dice rolled on this iteration of the simulation.
I was using Perl a lot to manage an multi-thousand page external site, and a much larger internal site for a major division of a large aerospace/engineering company. These ware all scripts to run on the filesystem to do things like change the company name across thousands of pages, where the historical would be kept for past events, but the new company name would be used for current projects.
I sort of semi-nepotisticaly lucked into the job-- I was doing desktop publishing previously, and one of the managers at the division was a relative of my girlfriend. There also were very few webmasters around, and I had a lot of experience with graphics and the software around it.So I taught myself HTML, some basic programming, and was off to the races. But I was basically a just "computer person", but not much of a programmer.
Doing anything by hand on a site that big was just not going to happen, and Perl had a bunch of great pre-made scripts available for doing lots of stuff, but it was murder trying to modify any of them. It was clear that Perl just was too much work to learn, and the "one way" philosophy of early Python made the documentation easier, examples more consistent, etc...
But Python was much more approachable. It was also pretty clear that it had a better future, and had a pretty good (not great) set of libraries available, pretty good regular expressions, and really good integration with just about anything on Windows 95 (via an external COM library). When I started I didn't realize how the ability to script I.E., or Excel, or whatever was a really powerful tool that saved me countless hours. For example, of of the Marketing execs wanted to review every web page, but didn't want to use a browser, so via Python's COM tools, I could script IE to open, log, and print every page. When something failed (e.g. printer ran out of paper) I could use the log to restart wherever I needed. I could also grab a bunch of data from an Excel workflow some engineer had cooked up and dump all the data into a database, so they could use the tools that were comfortable for them, and still centralize it enough to generate dashboards or reports or whatever for management.
The performance wasn't that great, but computers were getting better, faster, all the time, and programmer productivity was starting to become much more of a concern.
When I took an "intro to programming for scientists" type course in early 2010s, it was taught in Ruby. This was at the height of ROR's popularity, and the instructor must have been curious about Ruby.
So Ruby became my first language, and for a year after taking the course I did all my scripting in Ruby. There was nobody around me (a lab full of C and Fortran coders) to tell me otherwise. Eventually, I switched to... MATLAB, and a couple years later to Python.
And in 2023, I don't remember a lick of Ruby. But I remember it was fun to code in it.
https://stratoflow.com/introduction-to-mojo-programming-lang...
- The common wisdom back then was that Python was attracting mostly C programmers who were looking for a faster way to write C and to interface with it, while Ruby was attracting mostly Java programmers who were tired of writing FactoryFactoryFactory classes. As a result, the Python community had a lot more C programmers who were able to work on the lower-level parts of Python (such as the VM and native libraries, like Numpy).
- The original Ruby interpreter (MRI) was very, very slow. It was replaced by YARV when Ruby 1.9 was released. YARV was a bytecode interpreter, while MRI, if I recall correctly, didn't even use bytecode. It just did the parsing while it was executing code. Before the switch to YARV, I remember regularly seeing Ruby at the bottom of the programming language benchmarks page, and it took something like 100x-150x longer than C for a task. Python was about 5x as fast as Ruby back then, IIRC.
- Aside from speed, the Ruby VM had a lot of other problems. The Python VM was rock-solid in comparison. See the links below for more info.
- The Ruby community back then had a reputation for being... unruly, let's say. Some characters there. It also suffered from that sort of chronic beginner syndrome that appears in isolated programming communities. I remember one guy in particular who was fond of justifying Ruby's weaknesses in odd ways. (For example, he said that Ruby doesn't need a debugger because it makes coding so easy that you'll never need one! In reality, Ruby didn't have a debugger because no one felt like making one.)
Here is a blog post talking about issues with the Ruby VM: https://web.archive.org/web/20100606205042/http://cbcg.net/2... (I never forgot that title, haha)
and the discussion on reddit: https://old.reddit.com/r/programming/comments/1kg8e/python_u...
In a world before good dependency and package management, being able to do most things using the standard library made things much easier!
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.
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.
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.
Now I really despise Python. It's the source of probably 80% of my day to day pain in managing a complex set of infra. It was just never meant to scale to the level of complexity in which it gets applied. And certain types of algorithms / logic turn into and incomprehensible unmaintainable mess when done using so-called "idiomatic" methods.
But as a language, its simplicity, transparent, direct and open design make it highly amenable for this sort of ubiquitous application in ways Ruby just isn't. Ruby is all about incorporating a large amount of knowledge of implicit behaviour into your mental model, and then it works great. Python is about knowing nothing. If you come to Python knowing nothing at all, there are probably 5 - 10 land mines to step on but after that its just "what you probably think it does is what it does" territory.
Ruby doesn't have anything unique going for, its success as an "aesthetic language" can be easily copied by python, once it's become ubiquitos
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.
Also, a number of top-tier websites (YouTube, Instagram, Dropbox, Netflix) made Python a central part of their stacks.
I'm using both Ruby and Python for tooling (so there is neither Web nor ML context. Neither meta-programming). When it comes to Ruby I learn one thing and safely extrapolate, i.e. you don't need to learn all of the language to be able to use it. With Python I've had to come to the docs many times to understand how a particular thing works and I keep finding ways to shoot in my foot. This includes very basic stuff like variable scoping (global, class, instance or local) or type non-obvious type conversion (in Ruby only nil and false are treated as false in conditional expressions, while in Python this includes empty string, empty list, empty dictionary and so on).
When it comes to readability in Ruby it is natural to do data processing by "pipelining", e.g. you don't need to do f1(f2(f3(f4(data)))) (which is often the case in Python) and instead you can do data.f1.f2.f3.f4 which is easier to read. Classes, objects, inheritance work and feel a lot more obvious. Ruby allows to be concise without sacrificing (for example "a = 5 if seta == true"). Overall Ruby allows to write more readable code than Python.
The space was not that crowded back then: Go/Rust did not exist, C# was Windows only, Perl was a mess, PHP was web only, Java was hated, Lua a niche and C++ too low level. And JavaScript was that slow thing in the desktop browsers. It was python or ruby and python like said was on every system and ruby the exotic thing.
The middle-ground coders - i.e. those that mainly use programming as a tool to solve some specific problems - but rarely delve into full-blown software engineering projects / complex programs / systems programming / etc. found Python to be really easy due to all the provided libraries, and lack of boilerplate code.
The "true" programmers use Python for smaller projects, like proof-of-concept / prototype work, and then continue in a language that's easier to work with as the codebase grows.
Of course, there are many more beginners / novices that will only briefly touch Python, than seasoned pros, hence the rise in popularity. Python is no longer scaring away people from coding.
My "load bearing" language path was Fortran -> (Forth) -> C -> C++(YUCK!) -> Python/Numeric/Numpy/scipy/et al.
I'm now dabbling with Julia.
In addition to Numpy (and it's predecessors) making array computation dead easy to express (slices!) for me personally it boiled down to Guido having taste that matched my own.
I'm sure that YMMV...
I had an opportunity to be exposed to Python and Ruby at roughly the same time.
Python the IPython notebook had started showing up, and the dust had settled a bit on the Py2 -> Py3 transition. So while I was working on a Python 2 codebase, the general vibe of the community was "let's not break more stuff". Pseudocode -> Python translations were pretty straightforward.
Ruby, the entry point was Rails. I bought books on Rails, could not for the life of me figure out how files got noticed by the project or not. I wanted to do something like passing in a function, went on an IRC channel, got yelled at for not doing things the "Ruby" way. Lots of "clever" methods on objects that were neat but didn't really look like pseudo code.
My experience was deeply coupled with Rails, and I think in an alternate universe where I was using Ruby for scripting I would have come out with a different feeling. But Python mostly had no blocking issues for me (a person who was programming for a while at that point), and Ruby was a bit of an undecipherable thing from an operational perspective (even if I could look at a code fragment and understand how it worked).
Python made a great decision, it was the anti perl. One way to do things, keep the syntax easy and simple. Force whitespace indents. Before python got really "pythonic" It read like pseudo code. As someone that explored Ruby for a bit, Ruby has too much magic. Magic is cool when you're the one casting the spell, but for your audience, it's annoying if their job is to figure it out.
It offered OOP, but was like C++. It didn't force it on you. If you came from a C background, you could write C like code. If you came from an Objects/structs background you can do OOP.
It then offered a great standard library. It had a REPL. DO NOT UNDERESTIMATE THE REPL. Not just a basic REPL, but an interactive one. dir()? __docs__? The power of man pages built into the REPL, allowed one to explore an unknown library.
Say what you want, but the FFI was well thought out and embraced. This made it possible for lots of C library to be made available in Python. PyQT, wxPython, allegro, OpenGL, all these paved the way for NumPy,TensorFlow, PyTorch. Your favorite graphics, sound library and many other libraries where wrapped in Python. You didn't have to write C anymore for most people with computers being fast enough.
Python won because of many little correct decisions along the way. The python2 to python3 drama was not a nightmare like perl5 -> perl6 or VB to VB.NET. Many good little decisions with a big of luck helps.
Python is delightful once you get off the ground, and before you've made anything too complicated yet.
And, oh. Just realized that self.name (object.variable) quietly retrieves the Class.name class variable (class "attribute" for the pedantic) :|
Hate how dynamic languages bend over backwards to not report an error. I would much prefer the "inconvenience" of having to compile my program and then be told what all is wrong at compile time. Sad that this is now popular. The language is very adhoc in general.
1. https://www.udemy.com/course/real-world-programming-for-kids...
Python became popular because: if you want to write a program that runs from the shell, uses file I/O, terminal I/O and possibly network I/O, that's quick and easy to work with, and where the runtime is either already on your computer or can be installed painlessly, there weren't many alternatives.
Shell script is too crappy a programming environment for anything non-trivial. Perl is a mess. Ruby isn't on the machine and is (still!) a nightmare to install. Compiled languages are not quick and easy to work with. JS doesn't exist yet (in a form usable from the shell). Tcl is too niche.
Python is the least worse choice.
All the stuff about ML and stats and Jupyter and what not is not relevant -- that came later as a consequence of Python already being popular.
It's actually amazing that Python is still popular because it nearly shot its own feet off with the 3.0 nonsense. Most folks here probably don't even remember that...
Rails was ahead of it's time. The alternatives in that era were ... well, they aren't around any more. Rails was to the alternatives what an iPhone is to a flip phone.
Python is useful with a low barrier to entry. It's valuable and available. It isn't competing with anything. It's useful in the way that spreadsheets are useful.
Just as databases didn't "lose" because spreadsheets are more widely used, neither Ruby nor Python has won or lost. Python is more useful in high-value areas, particularly data science. And ruby is still more fun.
If ruby had been there with a ruby micro framework available we might have used that.
But Rails based apps then quickly developed reputations for performance issues and for managing gem dependencies being a nightmare. Then Node came along and was the new exciting thing. npm was easier to use and a lot of people jumped on that for a while. It was exciting because most of us were already fluent in JS. So it was just using a language we knew in a new context rather than picking up something totally new.
Why is Python the soup du jour lately? Well it has been around for a while and has a reputation for being mature and having mature libraries. It also became the best language to hire junior devs because of its ubiquity in US universities. Even if you don't go into CS as a major or minor there's a good chance of getting exposed to Python. It also has some advantages for collaborative codebases like the language itself being opinionated on formatting and having lots of well developed tools.
Is it the Right Choice(tm)? I dunno. It definitely has downsides as well. But every team has to decide for themselves, and not all good reasons are technical (eg the larger pool of junior devs today than say, RoR.)
That's when I realized something: The book, and thus Ruby on Rails, appealed to teenagers as their first programming language.
Teenagers get very passionate about things, and emotionally involved with their choices.
Python is a tool. Good tools are boring, and don't come with references to bacon and other grammatical jokes. They are about performing a task; and they don't need to entertain in order to keep a teenager's attention.
I look at RoR as a way that many young people got excited about programming, but not really the best tool for the job. It deserves a place in history next to Visual Basic, because it met people where they were and allowed them to build something "good enough" when other tools were too difficult or time consuming to use.
Ruby starts off by saying you should have a version manager. And windows installation is not straightforward (from a student perspective it’s important to note that something that looks like it isn’t officially supported makes it feels like the entire language is going to be a compatibility slog). This is not dead dead simple. It’s not hard. But it requires more than one concept to be learned to start.
Then the docs. Ruby has so many ways of getting started. Python puts up one main way. Same for the api reference. Python has a single link and they even say “keep this under your pillow”. As a beginner I know what I should do. Ruby? Many links that say arcane stuff (beginner perspective) like rdoc and what not. Python is super clear in their breakdown of reference too. I cannot stress enough how simple this page (https://docs.python.org/3/library/index.html) makes it to find what you want.
Overall Ruby and it’s documentation feels like it’s made for people who know Ruby or something more than the bare minimum. Python is made for people who’ll be trying out programming itself for the first time.
To me, that’s what made Python win. They just seemed like they thought more about folks starting out for the first time.
- Ruby and Rails are joined at the hip in a way that Python isn't. While Ruby is a general purpose language, it was only strongly adopted by web developers.
- Rails didn't have a competent deployment story initially. It was a pain to deploy and run mongrel relative to other platforms and this only seemed to get effort after the first RailsConf. The impact of this was primarily on enterprise developers who might have gotten adoption to a higher level.
- Speaking of the first RailsConf, DHH did everything possible to undermine potential advocates within the enterprise space where lots of Java refugees might have helped with adoption. ThoughtWorks backed Ruby and Rails, but there are quotes from Martin Fowler like:
"A couple of years ago I wrote about the impressions people had that the RubyPeople were notably more friendly than most software communities. Talking to people at RailsConf I got the message that that had changed for the worse. Both the ruby lists and particularly the rails lists had tended more towards the sad Internet mean. In his opening keynote Chad Fowler said that the rails community had a reputation as "a bunch of arrogant bastards" and I cringed as an, admittedly small, group raised a triumphant cheer." (https://martinfowler.com/bliki/RailsConf2007.html)
- The community was very anti-Windows which stifled adoption. The default developer machine now seems like a MBP, but it wasn't in 2007. Rails got lots of attention around the time of the Intel transition so this was a cool time to have a Mac. A PC was only usable for Rails work if you put Linux on it. Some people realized you needed better basic Windows support to run Rails for development, but it wasn't a priority. Again, this limited potential web adoption.
From this you can see a repeated pattern of mistakes which would have at least increased Rails use in the enterprise market. It was strongly adopted in startups and niches within enterprise that IT didn't control. There was no real reason to discourage this community of developers who found Rails a nice fit for what they were building.
Now Python:
- The Python community specifically targeted diversity and getting adoption in first programming classes in colleges. This was an active effort that accelerated things at least as much as use in data science. The fact that everyone was being taught Python as a first language even if they'd go the web route was a huge boon to cement it within the data science perspective.
- In the previous point I called out diversity because it was a key differentiator in getting it everywhere. Not everyone stayed in the community, but they stayed at a higher rate than Ruby. People will want to discount this because they feel it's political or woke, but it affects the TAM. I don't think you can substitute "friendly" because they knew that wasn't sufficient.
- Python has had stronger Windows support. The effort was inconsistent over time, but it existed and wasn't discouraged to the degree that it was for Ruby. Companies like Active State where popular long before Anaconda appeared on the scene.
- Packaging in Python is a disaster zone, but it's been good enough to get adoption.
- Google gave credibility to Python at a time when it was competing with Python. This swayed non-devs in decision-making roles to an extent. Importantly, Python hasn't been wed to one vendor. When Google dropped, other stepped into the fray. It seems MS are quite involved today.
- The transition from Python 2 to 3 is viewed as a misadventure by many. It did this and still won out. If you rewind to PyCon 2009/2010, the vision shared by Guido was for a long term transition with some degree of experimentation. People have forgotten, or joined late.
- Data scientists have taken over the Python community, but Django and Flask are still pretty sizeable communities. This diversity is a strength and the community is open to experimentation.
- Python performance doesn't suck much more than Ruby for the most part. If Python had disadvantages to a peer like Ruby, it may have had an impact. Instead, people inside the community complain and stay, or they peel off to Go/Rust/C#/Java/Kotlin (any faster platform) at a slower rate than you might expect. Yes, whole teams/apps drop it wholesale, but what matter is the overall number. I think this is more of a concern today (like packaging is) than it was in the key period of 2006-2012 when the battle was fought.
At the time this was happening, neither Ruby nor JavaScript were credible alternatives, Python won by default. The only other scripting language I can remember being used in similar contexts at the time was Tcl.
The other half of it is that Python had a great C binding story, which made it easy to integrate Python with almost everything since C ABI was the lingua franca of interoperability. You could wrap high-performance code in a thin layer that would allow you to efficiently script it in Python. This is why Python became ubiquitous in HPC/supercomputing decades ago. It allowed Python to have a vast library of functionality with good performance and minimal effort by leaning on the vast number of C libraries that already existed to implement that functionality.
Another underappreciated advantage of Python, a bit like C++, is that it is promiscuous language. It isn’t so in love with its purity that it won’t happily do slightly dodgy things to hook up with things that were never intended to work together. It may not be pretty but you can actually make it work and the language doesn’t try to prevent it.
As time went on, a school of thought emerged that you could efficiently do almost anything you needed to do in software engineering with a combination of Python and C++. There is definitely an element of truth to that, and the ease with which you can combine those languages made them common bedfellows in practice.
Python initially won because it was better for writing complex software than Perl, but its staying power was based on its easy integration with literally everything.
Ruby stupid symbols vs string make code super error prone. Symbolize? Wtf . Also mutable strings are a minefield.
Python semantic spacing is stupid, its bullshit and I've spent crazy amount of time fixing stupid "bugs" that a pair of braces and Ctrl+k F would fix in a second. Also why isnt there a freaking string.length function? Why a len operator? Why not a height operator? Or weight or whatever? Inconsistent.
Their late coming to static typing is soooooo funny . Apparently static typing is not that bad (having had to maintain a huge ruby system would make you WISH it was in some static typed language... even java)
Also isrubyfastyet.com ?
Anyways, both are ok , but I wouldnt build large systems with any if them.
Python happened to be either competitive or dominant in the two biggest niches outside web frontends.
Being a default install also has a lot of barrier-to-entry advantages in other settings, particularly in academia where there are similar (but usually not nearly as strict) bureaucratic restrictions on installing things, etc.
source: was a DoD computer science researcher focusing on ML for several years and witnessed people reach for python because they were still waiting for months, sometimes years for whatever software package or language to be installed / approved by security/IT and had no other dev tools
Back in the day, Perl had all the libraries and they were easy to install and worked well, then Python overtook this had all the libraries. Ruby never really had enough libraries to compete against Python.
Between 2010 and now, among "backend" languages I've picked up and played around with there's been Java, C, C++, Haskell, Scheme, Racket, Prolog, Forth, Go, C#, and Rust. You could throw bash, JavaScript and Verilog onto that pile if you want extra oomph - and indeed I switched from bash to fish last year, because it was just a much better language.
So when a tool shows me a decisive advantage, I do switch. But nothing so far has done so for Python for me. I just don't see any decisive reason to switch when I already think in Python.
Ruby is everyone's favorite toy: Fun to play with, and you shouldn't do anything serious with it.
Lua is simpler and, with LuaJit, much faster and far more C compatible.
C is still very widely used and generally comes above Python in the "best" language lists.
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.
Contrary to popular belief, Python is older than Java.
> math libraries, numpy and pandas make it appealing to academics
The most important factor: these libraries are free.
I've always used Javascript and have been using a bit of Rust lately.
But I guess what made it "win" lately is IPython/Jupyter and Conda, which enables non-programmers to use Python as a language to express and solve their problems, like Mathematica or MATLAB did for mathematicians and engineers.
So I guess that Google added a bit to its popularity.
Today I'm starting to move from Python to Deno though. I'm still fed up with how bad the Python2 to Python3 transition went, and Python3 has all the wrong goals for what I'm using it for (it tries to be a "real" programming language, when I just want a cross-platform scripting language).
This is before all the current machine learning stuff.
Great standard library (Javascript still doesn't have one). Even better than Java's
Cross-platform
Interpreted language with minimal environment needs where just having python.exe is enough (compare build systems C or Java, or environment setup needed for PHP/perl)
Great DX given how simple core syntax and standard libraries are (again, compare with perl magic, or PHP madness)
Early numpy/scipy packages found amazing uptake in science community which acted as evangelists. This happened to great DX (scientists don't like coding C) and great C support (they still need C speed)
Your impression is false. In the 00s, Python was a slowly growing language that had a few niches that it was extremely popular in. Meanwhile Ruby (well, Rails in particular) was the Next Big Thing and immensely popular, especially for new Web Applications.
What happened is that Rails' schtick got less unique as more MVC frameworks were created for other languages (CakePHP, Laravel, Django, etc) and Node was released. JavaScript/TypeScript has filled all of the same areas Rails used to and is even more accessible so is the new Next Big Thing. Meanwhile, Python just continued steadily growing and a few of it's niches have become very important to businesses (Data Science) and the tech sphere, in general (Machine Learning); exponentially increasing it's uptake.
So, while RoR is still very popular in web shops, it's more common to be seen in legacy codebases (3-5+years or older) and less so in newer ones (where Node/Deno has taken it's place). Python, on the other hand, is very popular in two very greenfield spheres that are continuing to grow fast.
I believe it was because python prioritized terseness and at the same time readability, while ruby prioritized cleverness often it was harder to understand someone else's code or even your own after a while.
That was at least the reason I avoided ruby, it felt like a descendent of perl.
Ruby became popular when Rails exploded and everyone got into Web 2.0.
Lots of other frameworks came out after that and there was no other killer Ruby apps. But that doesn’t mean that the Ruby ecosystem weren’t doing great things. Just no “big hits”.
Computer Science departments started offering their intro CS classes in Python instead of Lisp. So it is no surprise why it exploded.
A lot of Ruby-ism has found itself in Elixir. Which seems to slowly be gaining traction.