

Learn Python or Ruby? - jkaykin

I want to learn either Python or Ruby, so which language do you recommend, why do you recommend it and what are the best tools/books/tutorials to learn that language?
======
david92
Python and Ruby are very similar. Here are some of the differences that I see:

Python's design and community encourages a more object oriented style. Ruby
encourages a more functional style.

Python lacks some support for closures and inline functions. Ruby has good
support for both.

Python has libraries for almost everything. Ruby's libraries are more web
focused. It also has libraries in other areas, but not as much as Python.

Ruby is a little more flexible, which leads to some of the DSL's and
metaprogramming that seem to be common in the Ruby community.

Ruby has more syntax than Python. Ruby has a few ways to do things, while
Python tries to stick to one way.

Both are good. It might help to skim through a tutorial for each first, and
see which one you like better. Between Python and Ruby, I think it mostly
comes down to taste.

------
tsurantino
Learn both. A lot of people say Ruby & Python are very similar, I disagree.
They are similar in that, they look at similar problems (domains - although
Python is applied in much greater variety by its community, ie. sciences, web,
gui, server admin, whereas Ruby's popularity is primarily in the web).
However, they are different in that their design and philosophical ideas stem
from two very distinct ways of approaching the building of software.

It is commonly expressed that in Python there should only be one way, and only
one way to do something (Pythonic). In Ruby, you can express yourself in a
number of ways. Not in ways that are subjective to your taste, but subjective
to the needs of your solution.

The way Ruby approaches blocks (and closures) is unique. There is no
substitute and Python, and it forces you to code in a manner that is unique to
the language. It exposes you to different design patterns and a new way of
thinking.

\---

To keep it short, learn what language best suits your needs. If you are doing
this for fun and are just starting out, I recommend Python. Ruby does way too
many things implicitly that it'd be hard to keep track for a beginner (but you
can be pragmatic and learn as you go).

For resources, here are my recommendations per language:

Python: \- Udacity's courses are fantastic. They are engaging & challenging.
They will teach you the language features as well as resources. They also
handle domains from debugging, to simple console software, to web
applications. <http://www.udacity.com/> is your reference. \- Learn Python the
Hardway is usually a good way to breeze through the syntax. \- Think Python -
a fantastic book. \- Dive Into Python 3 - also a great short intro.

Ruby: \- PickAxe. Google this. Must read book. Absolutely _amazing_ reference.
I don't think you need anything else if you read this. \- Rubymonk, if you
want to do fun exercises. Also a good intro to the syntax.

------
bobfirestone
The two languages are very similar. What I would really suggest is see which
has the more active user group in your area. This is actually how I ended up
learning ruby. If I had found another user group as active in my area I would
probably be coding in that instead. Having someone infront of you to ask dumb
questions is amazingly helpful.

What resources are best depends on what level of programming experience you
are starting with. For Ruby: 0 experience I recommend starting with Learn to
Program by Chris Pine Have some experience go straight to Learn Ruby the Hard
Way by Zed Shaw After you have some exposure to the ruby language start on
rails with the Rails 3 Tutorial by Michael Hartl. It goes step by step through
building a twitter clone. Follow the Rails 3 Tutorial with Agile Web
Development with Rails. It builds a shopping cart using a different
methodology than the Rails 3 tutorial. After that I the classes from code
school are pretty awesome and the railscasts by Ryan Bates is the best $9 I
spend a month.

------
MattBearman
I'd recommend giving them both a try and see what suits you best. There are
loads of interactive tutorials online for both languages.

I personally found I preferred working in Ruby, so that's what I use - eg: I'm
not a fan of significant indenting, I like that in Ruby you have to put 'end'
(or '}') at the end of code block, I find it makes it more readable.

Also, if you're going to be doing web development, be sure to check out the
available frameworks. Rails and Sinatra are the main Ruby ones, Django (and
I'm sure others) for Python. Again, I found Rails works in a way that makes
sense to me (probably because I came from CodeIgniter in PHP) so that helped
sway me towards Ruby.

If you do go down the Ruby on Rails route, be sure to check out Why's
(Poignant) Guide to Ruby and Rails for Zombies (<http://railsforzombies.org>)

------
hasenj
My major pet peeve with python is that closures are not done quite right ..

[http://stackoverflow.com/questions/141642/what-
limitations-h...](http://stackoverflow.com/questions/141642/what-limitations-
have-closures-in-python-compared-to-language-x-closures)

Ruby does seem to have somewhat more powerful constructs (e.g. blocks).

One nice thing that python has (which ruby doesn't) is indentation-based
syntax. With ruby you have to use "end" all the time to signify the end of a
block.

------
hoka
What are you hoping to accomplish? I've been working through python, and it
seems like most ruby tutorials are geared toward web development, while
python's tutorials are more varied. There are plenty of python webdev
tutorials, especially for django, but there's also a bunch of
statistical/scientific ones as well.

Not saying Ruby doesn't have all that stuff, though. One factor was how much
of a pain it is to develop Ruby on Windows.

------
tangue
I'm a webdesigner and I have decided to learn to code. First I tried Python,
it was cool, I had a great feeling with the language BUT there was not enough
GOOD tutorials for web development. I switch to ruby and I was able switch
easily from "Rails Tutorials", to "rails for zombies" to "PeepCode" and now
I'm able to produce a decent website on my own. I wish it were the same with
Python but now it's history

------
Phra
Learn Perl! Perl has: \--------------------- * Great Community * CPAN - With
Perl you have one command to access literally tens of thousands of open
sourced modules * Awesome Tools: \- Moose for best way to model objects \-
Plack for web application building \- perlbrew ... And Perl is open source
software among many other things.

------
runjake
It depends on what you want to do. They're about "equal" in general terms. But
you haven't provided more details so I cannot answer.

------
Toshio
They are both very expressive languages, but the one difference I noticed
between Python and Ruby is what happens when you read someone else's code and
the code hasn't been aggressively unit-tested or properly designed upfront.
Ruby code tends to be much more readable in that case, and it's much more
likely that you'd scan through it and go "Oh, I see what he's trying to do
here" than with Python.

