4 ms·
This is a fairly superficial difference, but Python's syntax grammar is very conventional, Ruby's isn't. Compare the grammars of Python, Ruby, and ANSI C. Pyt
by Goladus 16y ago
This is a fairly superficial difference, but Python's syntax grammar is very conventional, Ruby's isn't. Compare the grammars of Python, Ruby, and ANSI C.
Python: http://docs.python.org/release/2.5.2/ref/grammar.txt http://docs.python.org/release/2.5.2/ref/grammar.txt
Ruby: http://web.njit.edu/all_topics/Prog_Lang_Docs/html/ruby/yacc.html http://web.njit.edu/all_topics/Prog_Lang_Docs/html/ruby/yacc...
ANSI C: http://www.lysator.liu.se/c/ANSI-C-grammar-y.html http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
Python and ANSI C both have a similar organization of productions and names for statements and expressions. It's pretty easy to follow the grammar to obvious points where the language differs. What are valid unary expressions in Python and ANSI C? There's a production in each grammar that makes a convenient starting point and comparison is easy. What is a valid unary expression in Ruby? It's much less clear.
The Ruby grammar isn't large, so I'm sure some people prefer the way it's organized. Once you've absorbed the whole thing questions like "what's a valid unary expression?" don't matter anymore. But I think it's an interesting distinction to someone trying to decide which language to learn.