top | item 449230

Ask YC: Ruby or Python

2 points| ssharp | 17 years ago | reply

In web development, I've pretty much been PHP only with some Perl tossed in here or there. I'm looking to learn a new web language and framework and have decided that its either going to be Ruby or Python. I'm not worried about the learning part. If one language takes more time, then so be it. I'm just looking for some advantages and disadvantages with either.

Outside of web development, I've also worked with C, C++, Objective-C and Java, so I'm not a hideous PHP programmer void of any elegance in coding and design, just a programmer who has mostly work with PHP!

13 comments

order
[+] compay|17 years ago|reply
Asking this here is fairly pointless. When you ask this sort of question people tend to just go on subjective rants in favor of what they like, and flame people who disagree with their tastes.

The best thing you can do is put the time into reasearching the two until you are convinced for your own reasons to learn one, both, or neither.

Either way, both are good, important languages with quality frameworks and potential for job offers. So really you can't lose.

[+] ssharp|17 years ago|reply
I'd be fine hearing some subjective rants in favor...
[+] russell|17 years ago|reply
I looked at both several years ago and picked Python because I thought the language and implementation was cleaner and better designed. The set of libraries was larger and the community was very responsive and helpful. Ruby has come along a lot since, but I still think the advantage is to Python which is still evolving without becoming a junk pile.

But as others have said, the two are close enough that you won't do badly by going with your own preference.

[+] BinaryPie|17 years ago|reply
I would use whatever seems to suit best for your task at hand.

Need to build a site quickly that is mostly information based such as a blog or some kind of editorial site. I'd choose python with django. The automatic admin section is great for this type of task.

Need to build something with a lot of popular features (twitter, mash ups, simple shopping carts, etc..) and don't have time to really learn every little detail. Ruby using Rails might be a good solution as there are thousands of demo and live applications out there to borrow from. Should reduce your development time.

If you are looking for a new hobby language. I would choose python as it doesn't have quite as large or fanatic following as ruby. It also has a lot of room for growth. There are many libraries and verticals in the python market which could use some help.

End of the day though. It's up to you and the problem you are solving.

[+] jjames|17 years ago|reply
I have worked with Python and Ruby for nearly 10 years while being paid to code in Perl for a bit longer and honestly still to this day I wrestle with which language to build a new project. They are all wonderful and terrible.

The only insight I can offer you is that you can do everything you want to do in any of them. The points of consideration for which you learn then boils down to community, longevity (~market value of the skill/time) and personal interest in the specific tack each language takes. If you enjoy programming languages, there are different "interests" in Python, Perl and Ruby. Comparing the ways that Python and Ruby address Meta-programming, I think, will illuminate which for you is more interesting (which fits your brain better).

My other advice: Learn it all.

[+] mdipierro|17 years ago|reply
Before investing time in learning a new language you may want to consider other "features" of a web framework that may help you choose. For example, give a try to web2py since it does not require installation (just unzip and starts). It includes sqlite and ssl enabled web server. You can do all development and maintenance via the web interface. In 5 minutes you should be able to write a simple app like:

    def hello(): return "Hello %s" % request.vars.name
Then you decide if it is worth your time to learn the language. Usually learning the APIs of a framework take more time than learning the language it is based on.
[+] davidw|17 years ago|reply
Yes!

(Or, since someone didn't like that response, look up all the previous instances of this discussion on this very site, and see if there's something they didn't cover. Otherwise, either language is just fine)

[+] aitoehigie|17 years ago|reply
I would say Python. why you may ask? For the following reasons: 1. A wide collection of web frameworks from which you can choose from, e.g Django, webpy,turbogears, web2py, karrigel the list goes on. 2. If you are so inclined, you can roll your own framework the help of WSGI. 3. Python as a language is very simple and for an experience programmer, you can be up and running within a week. 4. The python community is huge and helpful, with a lot of books and documentation. Just my 2 cents anyway.
[+] psadauskas|17 years ago|reply
All those things you said are true for Ruby, as well.
[+] pavelludiq|17 years ago|reply
The question is wrong. The correct question is not "ruby or python?", but "python or ruby?" :D Either one will do actually.
[+] Klonoar|17 years ago|reply
I've found that I prefer Python over Ruby simply for the forced-indentation. It peeves me to no end when I work with others and they have horribly disorganized, unreadable code.

Granted, I like Python for other reasons as well, and I'm a Django fan to no end, but... yeah. Forced indentation for the win.

[+] c1sc0|17 years ago|reply
Something that may be of interest, given your C background: Python and C mix really well. Not sure if that is relevant in web-centric development, but it is when you want a more general-purpose language.