What's better about Ruby than Python?

John Roth newsgroups at jhrothjr.com
Mon Aug 18 06:57:19 EDT 2003


"Brandon J. Van Every" <vanevery at 3DProgrammer.com> wrote in message
news:bhpbc6$1plpe$1 at ID-203719.news.uni-berlin.de...
> What's better about Ruby than Python?  I'm sure there's something.  What
is
> it?
>
> This is not a troll.  I'm language shopping and I want people's answers.
I
> don't know beans about Ruby or have any preconceived ideas about it.  I
have
> noticed, however, that every programmer I talk to who's aware of Python is
> also talking about Ruby.  So it seems that Ruby has the potential to
compete
> with and displace Python.  I'm curious on what basis it might do so.

Well, each language has to be considered on its own merits; however,
from my rather limited knowledge of Ruby, there are a number of things
I'd like to see in Python. None of them are showstoppers, but some of them
are definite irritations. Other Ruby features either don't make sense in
Python,
or would need a really different implementation.

1. The use of ! and ? as the final character of names to indicate that the
method modifies the object, and that it's a boolean question respectively.
I think the latter is handled adequately by saying "is" in front of the
method
name, but the former directly addresses the [list].append, .sort and
.reverse
idiocy of not returning a value.

2. Treating a module object as a non-instantiable class. This would
eliminate the distinction between methods and functions: everything
would be a method because there would be a well defined meaning
to "self." It also eliminates the need for the global statement.

3. Not having to write "self" in the method definition. This falls out of
item 2: since every function/method has an instance, there's no need to
declare it. I've thought of writing a PEP for this one.

4. Shortcut syntax for writing self in a method body. I don't particularly
like the way it uses capitalization to signal the namespace category (I
think Python does locals a lot better) but there's a lurking mess in
this area that needs to be addressed. (And I don't mean by saluting
it and saying "Yes, SIR!")

5. Blocks. I suspect they got them from Smalltalk, but the syntactic
support for one-time anonamous functions which can contain statements
is one of those things that does seem to make a real difference in
programming style.

6. The way Ruby handles parameterless functions as if they were
properties.

John Roth

>
> -- 
> Cheers,                         www.3DProgrammer.com
> Brandon Van Every               Seattle, WA
>
> 20% of the world is real.
> 80% is gobbledygook we make up inside our own heads.
>






More information about the Python-list mailing list