Ruby vs Python [OT]

bearophile bearophileHUGS at lycos.com
Sat Mar 6 03:39:09 PST 2010


Nick Sabalausky:
>I'm curious what you see in ruby as being worse for large programs than python.<

I know some Python, but I have written only small things in Ruby, so my judgement doesn't have strong roots. From what I have seen Ruby:
- Has more syntax freedom, this allows you to create a sublanguage fit for a problem, but also makes Ruby code more variable;
- Its syntax is sometimes more handy, like the function parenthesis that can be omitted, the automatic return value, but this also increases the possible bugs a little;
- Ruby monkey patching can be done in Python too, but it's considered a bad practice because it's not scoped. This Ruby practice sometimes causes problems.

Python looks like a little more tidy and regular language compared to Ruby. I associate this to the ability to write a little larger programs safely. But such difference between Ruby and Python isn't large, they are two similar languages (more than Pascal and C were). It's also a matter of programmer taste, there are people that like a little more freedom (Perl, Ruby, C), and people that like a "safer" language (Java, Ada, and probably Haskell too). D2 is a bit safer than C.

In any language you can define a style guide to help you write bigger amounts of code, this is the Google Style Guide for Python:
http://google-styleguide.googlecode.com/svn/trunk/pyguide.html

Bye,
bearophile



More information about the Digitalmars-d mailing list