[Tutor] Python vs. Ruby

Alan Gauld alan.gauld at blueyonder.co.uk
Thu Oct 30 04:06:55 EST 2003


> What are the advantages of Python over Ruby? They both
> look pretty good sytactically. 

The only real reasons I stuck to Python after learning 
Ruby were:

1) I hate languages that stick prefixes ($,@,@@ etc) in 
front of variables.

2) I hate languages that insist on everything being an object. 
I've used OO long enough to know there are times when it 
ain't the best answer...

3) The support in terms of number of books, newgroups/mailing 
lists, libraries, tools etc is much better. The communities 
are both very friendly and supportive but there is just so 
much more for python.

However Ruby does offer some nice features that Python lacks
(code blocks for example) but Python is catching up (it has 
added iterators and generators and new style classes since 
then...

> Ruby does have annoying end keywords, 

I can live with those. :-)

> Python, you have to write "self." before every
> variable within a class, whereas in Ruby you just
> prefix it with "$". 

Personally I find 'self' clearer. But then I do that 
in C++ and Java to - using 'this' of course!

> Ruby typically writes shorter code, and I think that's 
> pretty important 

Really? I hadn't noticed. It can't be very much shorter.
I'd think its a little like Java vv C++, it depends on the 
problem domain as much as the language. Java is usually 
cited as being shorter than C++ but in every significant 
program I've written using both  C++ is shorter! Ruby 
didn't *feel* shorter than Python to me - but I never 
thought to compare them directly.

Alan G.



More information about the Tutor mailing list