Python and Ruby

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat Jan 30 20:16:04 CET 2010


On Sat, 30 Jan 2010 16:58:34 +0000, tanix wrote:

> In article <pan.2010.01.30.16.43.18.172000 at nowhere.com>, Nobody
> <nobody at nowhere.com> wrote:
>>On Wed, 27 Jan 2010 15:29:05 -0800, Jonathan Gardner wrote:
>>
>>> There's a lot of "magic" in Ruby as well. For instance, function calls
>>> are made without parentheses.
>>
>>That's also true for most functional languages, e.g. Haskell and ML, as
>>well as e.g. Tcl and most shells. Why require "f(x)" or "(f x)" if "f x"
>>will suffice?
>>
>>> Python is much, much cleaner. I don't know how anyone can honestly say
>>> Ruby is cleaner than Python.
>>
>>I'm not familiar with Ruby, but most languages are cleaner than Python
>>once you get beyond the "10-minute introduction" stage.
> 
> I'd have to agree. The only ones that beat Python in that department are
> Javascript and PHP. Plus CSS and HTML if you can call those languages.

Your sentence makes no sense. You agree that "most" languages are cleaner 
than Python, and then in the very next sentence, out of the hundreds if 
not thousands of languages invented, you can only list TWO that are 
better than Python -- and those are Javascript and PHP!!!

That's like saying "most things are harder than diamond -- the only 
things that beat diamond are jelly and talc".


> The very idea of using a number of blanks to identify your block level
> is as insane as it gets.

Not at all. People do it all the time. The very idea of expecting people 
to count nested braces to identify block level is what is crazy, which is 
why in languages with braces people still indent the blocks.


> First of all, combinations of blanks and tabs,
> depending on how your ide is setup to expand tabs, may get you bugs,
> you'd never imagine in your wild dreams.

Not really. The bugs are quite simple, and generally easy to fix. To 
describe them as unimaginable is stupid.

>>> for x in [1, 2, 3]:
...     print x
...     print x+1
  File "<stdin>", line 3
    print x+1
    ^
IndentationError: unexpected indent


If you can't imagine getting an IndentationError from making an 
indentation error, there's something wrong with you.

In any case, if your IDE mixes tabs and spaces, your IDE is broken and 
you should fix your tools rather than blame the language.


> Braces is the most reliable way to identify blocks.

Nonsense. For the compiler, both are equally reliable, and for the human 
reader, indents beat braces easily.


> Sane compilers ignore blanks altogether.

Really? So a "sane compiler" sees no difference between:

for x in mylist:

and

forxinmylist:


I'm glad I don't have to program using a compiler you consider "sane".




-- 
Steven



More information about the Python-list mailing list