Hacker News new | ask | show | jobs
Ask HN: Why are more Startups using Python over Ruby?
27 points by kp212 5360 days ago
It was just an observation I noticed with job postings, and meeting early stage startups. Is there a reason why Python + a framework has become more prevalent over Rails?
12 comments

I can't give you a definitive answer, but I'll explain why my company chose to use python.

NOTE: We're a technical startup in the telecommunications industry. We build web-based telephony applications in addition to traditional phone-based applications.

1. python's syntax is extremely clear and easy to read / maintain. I can open any python project, and immediately find my way around with no prior knowledge. This makes working in teams especially easy, when you have numerous developers committing various bits of code to various parts of the product throughout the day.

2. In the past two years, the python community has put a great amount of emphasis on documentation for open source projects (using Sphinx), and as a result of this, many open source python packages now have excellent documentation that makes it really easy to start using third party libraries and feel secure in your choices. Just check out http://rtfd.org/ for examples (ReadTheDocs is a hosted open source documentation site, focusing on python).

3. Django is an excellent web framework, and has tons of reusable open source applications that you can use, which makes rapidly developing web applications easy. The Django app ecosystem has been growing at an insane rate over the past few years, and there are more than enough applications to solve most common patterns.

4. Tools like tox, nose, coverage.py, and others make testing in python simple. It also helps that Django encourages testing in a large way (providing a default tests.py module for each application, with example tests). Having such a large emphasis on testing, with such great tools, makes it easy to "Do The Right Thing" and build tests into your software.

5. There are excellent tools in python for performing complex tasks, like celery / redis for building distributed queue processing workers.

6. PyPY (an alternative python interpreter) has been showing immense promise with python speed improvements. PyPY can be used as a drop-in python replacement on any linux system, and yields immense performance improvements to even the simplest code.

7. The python community in general tends to be very friendly, supportive, and encouraging. There are a lot of popular figures in the python community, and the overall personality traits of leading python community figures tends to be humble, helpful, and encouraging. This has fostered a really excellent community focused around accomplishing things, and helping people out, which I think gives the language a good overall feel.

Just my two cents.

Would it be fair to say the same points apply to Ruby/Rails (with name variances of course)?
None of the posts in this thread really answer the question to "why python over ruby", they just talk about all of the nice features of current python development. The thing is modern Ruby has all of those tool sets as well.

Before you even being to make the statement "Why are more Startups using Python over Ruby?" you need some data. I'd be willing to bet that more places do in fact use python over ruby, but that number is a lot closer to 50/50 than you think. In fact, it is probably so close that this argument becomes pretty silly.

I once heard a successful startup founder describe the choice to use Python over Ruby because a couple of years ago getting started with Ruby was too difficult for them. They had spent a day trying to setup Ruby, Rails, etc and nothing was going correctly. After that they tried to install Python, it worked, and from that point on code was written in python. This story isn't elegant, sexy, or thought provoking, but it goes to show you that there are all sorts of crazy, silly, and stupid reasons why some people pick one language over another.

Lets talk about reasons why startups are _NOT_ using Python over Ruby.

Python is not taught at more schools than Ruby. Well, I couldn't find a list of schools teaching Ruby, but search for the Python list (hint, its up on python.org). There are only a handful in the US and these look like nothing when you consider all of the places that use Java.

Python's syntax is not easier or better than Ruby's. Nor is Ruby syntax better than Python syntax. Anyone trying to compare the two is just looking for a flamewar. Omg significant white space vs lol meta programming type arguments.

Both languages have excellent documentation and community. Very hard to compare these sort of things.

Django is a great framework, but so is Rails. Both have very vibrant ecosystems that are just exploding right now.

Tools - great tool sets in both. If a Ruby tool comes out that is good you can bet your ass there is going to be a python port of it in the next few years (and vise versa of course). A single great tool is never bound to one language/framework.

Implementations - both languages have a ton of cool projects that revolve around finding alternative ways to rebuild the VM.

Go ask people why they chose to write in a language/framework. They are going to give you answers like "it's what we chose", "i dunno, we just knew it". Comparing things like documentation, community, MVC Frameworks, tools, syntax, etc with two languages like Python and Ruby is pretty silly because its going to become a wash every time.

The web stack in Python got dramatically better in the past two years: just take a look at Flask, Werkzeug, requests, class-based views in Django, etc.

There were major improvements in deployment, too: Fabric and supervisord are maturing very nicely.

Once you've nailed the CRUD part of your startup down and want to start slicing your data in interesting ways, you have extremely powerful and easy-to-use libraries like nltk and numpy at your disposal.

Finally, Python continues to get a tremendous boost from the fact that Google uses it to write sample client code for their APIs.

Better than before or better than Ruby?

I think you struck a valid point, though. There are lots of options for relatively small Python-esque web stacks, and considering that the architecture style seems to go that way – with lots of independent services and big JavaScript frontends – you're often quite well-served with Python.

But maybe that's just my somewhat biased perception, I wonder how the general trend of Python vs. Ruby fares in comparison to the trend of Django vs. Rails.

And speaking of bias: Once you get small services, interop features and libraries become quite important to save you work, and I have the feeling that quite often generic Ruby gems could use some work. Often there's a plethora of half-abandoned solutions for one task, all somewhat orphaned on Github.

Then again, both languages still don't come close to CPAN in that regard (then again, what does?).

Oh, I should've been clearer: I meant that things got a lot better than before. I don't know Ruby all that well so I have no basis for making comparisons.
+1 for Flask. I recently replaced a huge, bloated SOAP code base with around 200 lines of Python with Flask. I don't know if there is an equivalent with Ruby, but Flask is a pleasure to work with.
Python is a great language. Simple. Powerful. Easy to read. Why not?

Also django is pretty great with amazing docs. I know a lot of people argue against because the django community isn't as large as the rails community (and it isn't). All that matters is that it's large enough though (and it is). Hasn't failed to answer my questions yet.

What gives you that impression? Where did you get the numbers from?

I reckon RoR is faster for rapid prototyping and development of new features so I'd choose that in the beginning for a one or two man startup.

Later on if there's anything in particular you need that Python does, you can always recode once you're profitable.

Recode once profitable? That's one of the easiest ways to lose momentum.
I'd like to know where you are looking for job postings. Every posting I see is a Ruby on Rails shop. My own feeling around the bay area is that ruby/rails has overshadowed django/python...at least in the web arena.

General purpose stuff though I concur that python tends to beat out ruby. Except for maybe puppet.

It's a bit disappointing not to see more mention of Groovy/Grails.

It has all the great features you get with Ruby/Rails but built on two solid time tested technologies being Spring and Hibernate. Not to mention the ability to integrate with pretty much no effort with existing Java infrastructures.

So far you haven't provided a credible reason to think that "more Startups are using Python over Ruby?"
Haven't seen a credible reason to think the inverse, either.
In which case the simple truth is that, you don't have a reason to think "more Startups are using Python over Ruby" and you don't have a reason to think "more Startups are using Ruby over Python" (and you probably don't even have a reason to think the same number are using Ruby and Python.)

We might as well both face-up to not knowing anything about that particular question :-)

I switched from rails because I got tired of ruby magic breaking my code in difficult to debug ways. I switched to python because of its emphasis on clarity and readability.
Python is being taught at unversites, and Ruby isn't (that I know of).
Because they are just going by whats trendy I suppose. If they wanted to build something serious that can actually scale then they probably shouldn't be using a dymanic language at all.
The odds of your product ever having to scale are vanishingly small. Until you prove your product will actually need to grow to web scales, you should use whatever language allows you to deliver a product for the lowest possible cost in the shortest possible time. That usually means dynamic languages.
If you don't end up needing to scale then your application is most likely a failure, I guess I just don't quite get this approach of "we'll build it as cheaply as possible and then re-work it if needed" because I'm looking at this from the perspective of having worked for companies that did this (before I was working there) and then needing to deal with cleaning up the mess since their hastily built app did end up needing to scale. Web apps, by default, usually have the intention of attracting a wide user base so I can't say I agree with this line of thinking
You are suffering from selection bias. You experienced applications that already needed to scale. For every one of those, you have a hundred that never made it. Had they started with harder to develop with technologies, they would have failed without having any completed products.
Same reason rails was hot last year: fashion.