Live data from Hacker News

Learn Python or Ruby?

news.ycombinator.com

1–10 of 11 posts

Learn Python or Ruby?

#1
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?

Re: Learn Python or Ruby?

#2
My major pet peeve with python is that closures are not done quite right ..

http://stackoverflow.com/questions/141642/what-limitations-h...

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.

Re: Learn Python or Ruby?

#3
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.

Re: Learn Python or Ruby?

#4
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.

Re: Learn Python or Ruby?

#5
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

Re: Learn Python or Ruby?

#6
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)

Re: Learn Python or Ruby?

#7
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.

Re: Learn Python or Ruby?

#9
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.

Re: Learn Python or Ruby?

#10
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.

Post reply on HN