The syntax. Python's syntax is much cleaner.<p>I tried to find examples of Ruby's awful syntax in tutorials, but much to my surprise, the code in the introductory sections of a couple tutorials picked at random looks clean and the language seems nearly Pythonic. Contrast that with a function from an actual Ruby on Rails project [1]:<p><pre><code> def fresh_commits(repo, n = 10)
commits = repo.heads.map do |h|
repo.commits(h.name, n).map { |c| Commit.new(c, h) }
end.flatten.uniq { |c| c.id }
commits.sort! do |x, y|
y.committed_date <=> x.committed_date
end
commits[0...n]
end
</code></pre>
Whoa! This code apparently calculates factorials (with the ! operator), absolute values (of course |x, y| looks like the length of a vector), and biconditionals (to someone with a math background, a <=> b means a => b and b => a). The function ends with an expression on the last line that doesn't look like it would have side-effects. WTF? There are question marks and colons in weird places in that file, too. I started to translate the function into Python, to show you how much cleaner it would be, but I simply couldn't follow what the multiple nested map's and uniq is supposed to do. I'm certain that the Python equivalent would be much easier to follow. (Even if you take "equivalent" to mean "list comprehension" or "itertools.map" instead of the most readable alternative, nested-for-loops.)<p>I don't think this project is particularly good or bad. I merely picked a random piece of Ruby code from an app I installed recently, and I feel the difficulties I had with the syntax of this function are representative of my struggles with Ruby as a whole.<p>All the strange symbols make Ruby code very hard to read. For me, the effort required to learn a language is directly related to the number of operator symbols it contains. Ruby is nearly as bad as Perl or shell scripts. (The operators-are-bad penalty to my impression of a language is reduced if same operator exists in other languages I already know well, like Python, C, C++, or standard mathematical notation.)<p>In Python, by contrast, you can usually get a fairly good idea of what syntactical constructs do without consulting the manual, even if you're unfamiliar with them. (To be fair, lambda is an exception.)<p>[1] <a href="https://github.com/gitlabhq/gitlabhq/blob/5a214ee6f198a90f41a54b3dd7f2ff6a318a8deb/app/models/commit.rb" rel="nofollow">https://github.com/gitlabhq/gitlabhq/blob/5a214ee6f198a90f41...</a>