2 Replies - 893 Views - Last Post: 04 October 2011 - 09:32 PM Rate Topic: -----

#1 zem107  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 84
  • Joined: 10-April 11

Python or Ruby

Posted 04 October 2011 - 10:16 AM

I want to teach my brother programming but I'm not sure if I should teach him Python or Ruby. Both are easy and great languages, but I'm not sure which would be easier. I like Python whitespace because it makes code easier to read:

def a():

But statements are easier in Ruby.
And it is better practice to end a statement once you make it(because in other languages the 'end' is a closing bracket).

def a()

If anyone can give me feedback as to which would be easier for him to understand.

Also, he has no previous programming experience.

This post has been edited by zem107: 04 October 2011 - 10:18 AM

Is This A Good Question/Topic? 1
  • +

Replies To: Python or Ruby

#2 Simown  Icon User is offline

  • Blue Sprat
  • member icon

Reputation: 321
  • View blog
  • Posts: 650
  • Joined: 20-May 10

Re: Python or Ruby

Posted 04 October 2011 - 12:57 PM

I would go for Python, especially if you are beginning programming it teaches you that readability and indentation count, which is often missed in other languages, which I believe it very important.

What makes Python a great language to teach beginners is the simplicity of the syntax it uses, e.g. checking if letter in list:.

Another thing is that all of Python , including the primitive data types are objects, so you can teach slicing, joining, splitting, lots of things, without introducing a new level of complexity. Similar logic applies to Ruby though.

One thing to note is that Python is dynamically typed, so variables don't have to be given a type on initialisation, but it is enforced thereafter. If it's between Python and Ruby though, Ruby is identical in this respect.

You can see where a function or block ends in Python easily, even though it's not explicit, it's hard to confuse where a block ends as the indentation is enforced throughout Python.

Edit: And I forgot to say, you may get slightly biased answers as you are posting in the Python forum :P I tried to keep my preferences out of it.

This post has been edited by Simown: 04 October 2011 - 01:20 PM

Was This Post Helpful? 2
  • +
  • -

#3 Martyr2  Icon User is online

  • Programming Theoretician
  • member icon

Reputation: 4925
  • View blog
  • Posts: 13,317
  • Joined: 18-April 07

Re: Python or Ruby

Posted 04 October 2011 - 09:32 PM

I too would go with Python. I find it a more developed and wide ranging utility language that will give you much more in the way of learning programming. I find Ruby a little too expressive at times. Some people would say that is good, but when you write a solution on a help forum, you will get like 10 people saying "Or you could do it this way". Fine, you can do it 10 different ways, but sometimes for learning it is best to have a few good ways to do something.

Python is very broad in what it can do also. Want to network? There is a module for it. Want to connect to a DB? There is a module for it. Want to do some advanced math? I am sure there is a module to help you with anything you want to do. Ruby is good, but I find it still maturing.

I am not saying Python just because this is the Python forum. Ruby is a good language and it makes things really easy, but obviously you want to learn with something mature, structured and robust. Python beats Ruby on many of these things. Not to mention you can always learn Ruby later after learning Python since they share some concepts.

Was This Post Helpful? 2
  • +
  • -

Page 1 of 1