3 ms·
Ask HN: Ruby or Python?
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.
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?
* 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&source=hp&biw=1280&bih=647&q=site%3Anews.ycombinator.com+ruby+on+rails+or+python&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=2bdf121f4ce8a359
Thanks
- madhouse 16y agoYou 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 16y agoEdited. Thanks
- ygtckr 16y agoI 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/ http://ruby-doc.org/docs/ProgrammingRuby/ for beginning Ruby and http://learnpythonthehardway.org/index http://learnpythonthehardway.org/index for Python.
- rst 16y agoAs 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.