

Ask HN: Ruby or Python? - instakill

I've decided that this year I'm going to learn R as myself and a friend in the BI field are taking on a data-centric project this year.<p>While learning, I've been getting more and more curious about learning a language that lets you develop something interactive (a la website, web app etc.). Considering that I've got no prior programming ability, what would be a better option - Python or Ruby? Which is easier to get into?<p>* Apologies if this is a dupe, which most likely it is, but the search results don't factor for the fact that I'm a n00b: http://www.google.co.za/#hl=en&#38;source=hp&#38;biw=1280&#38;bih=647&#38;q=site%3Anews.ycombinator.com+ruby+on+rails+or+python&#38;aq=f&#38;aqi=&#38;aql=&#38;oq=&#38;gs_rfai=&#38;fp=2bdf121f4ce8a359<p>Thanks
======
rst
As a rubyist, my main reason for preferring it to Python is what you can do
with "blocks". The idiomatic way of iterating over the elements of an array,
for example, is:

    
    
      my_array.each do |elt| ... do stuff with elt ...; end
    

That looks like a control structure, but it's actually invoking a library
routine ("each") with a block of code (the part between "do" and "end") as an
argument. It's easy to write your own routines which also take blocks as
arguments, which effectively adds new control structure to the language.

This flexibility can be really expressive, but it can also easily lead to code
that n00bs find confusing. Python syntax isn't as flexible, but that can make
Python code more approachable, particularly to novices.

Aside from that, available libraries may make a difference; SciPy and NumPy
might come in handy for you, depending on what you're trying to do.

------
ygtckr
I think Python is a more beginner friendly language. I have started my
programming studies with both Python and Ruby and dropped Ruby on the way to
concentrate on Python. Some say Ruby suits their thought processes better, but
my brain works well with Python code. I don't think there is too much
difference between them from a beginner's perspective. I think you should just
start studying both of them and drop the one which feels clumsier. I, myself
gathered much benefit from this particular approach.

Besides the more languages you know, the easier it gets to learn new
languages.

I advise <http://ruby-doc.org/docs/ProgrammingRuby/> for beginning Ruby and
<http://learnpythonthehardway.org/index> for Python.

------
madhouse
You can't really compare Python to RoR, as one's a language, the other is a
framework.

It's either Ruby <-> Python, or RoR <-> one of the python frameworks (probably
Django).

Pesonally, I'd go with Python & Django, because I found the Django docs far
easier to understand, and less of a pain to set up.

Whenever I tried to follow any of the Rails guides, I was advised to throw out
everything Ruby my distribution made and compile from source - no thanks. With
Django, I could get started with what was immediately available, no compiling
neccessary.

That, and I found python to be easier to understand than ruby.

~~~
instakill
Edited. Thanks

