August 20, 2003
What's better about Ruby than Python?

There is a thread over on c.l.py on this subject.

It's generating orders of magnitude more heat than light. Jeremy Dillworth's post, though, is well worth a read. Certainly nothing here is going to convince me to switch over, but there are ideas here that Python could steal.

Python's way of defining static and class methods is nasty, I have to admit. The Python developers are looking at fixing this, but for the moment, Ruby is prettier here.

Ruby's operator overloading syntax also looks very nice.

Posted to Python by Simon Brunning at August 20, 2003 01:53 PM
Comments

As something of a Ruby devotee, I'd agree with Jeremy's post. Ruby has a more "pure" design, being OO from the ground up, but is a few years behind in terms of available and packaged libraries. Python has all the momentum right now, and I feel that for pragmatic reasons, I should switch to Python.

Every time I try, though, I just feel my brain has been too Ruby-fied to make the change.

Posted by: Charles Miller on August 20, 2003 03:06 PM

Bruce Eckel once said, "If you've used Python at all, you wouldn't give Ruby a second glance." A slight exaggeration, but basically true.

It looks to me, though, that the converse is *also* true.

It seems to be that Ruby and Python are *both* great languages. Once you know one, there is no compelling reason to try the other.

Posted by: Simon Brunning on August 20, 2003 03:21 PM

But as Bruce *also* said, life's better without braces!

Posted by: Simon Brunning on August 20, 2003 03:45 PM

Jus ried o clean my keyboard, and now he key is suck. I can no longer run my Pyhon programs, bu I can sill run Ruby scrips. A definiive improvemen.

Posted by: Fredrik Lundh on August 20, 2003 04:42 PM

I thought you were trying to cut down on low-value weblogs, Fredrik. (http://online.effbot.org/2003_08_01_archive.htm#less-is-more ) What are you doing reading mine? ;-)

Posted by: Simon Brunning on August 20, 2003 05:08 PM

One thing that I absolutely love love love love love about Python that I have yet to really see in Ruby is Python's modular system. I'm no longer completely convinced that a language needs to be "clean" in terms of OO style. But modular - yes. Ruby, Perl, and PHP all have these weird "require" and "use" constructs which load in other code, often based on a path.

The Modula-esque nature of Python (import foo.bar.baz) is an under-appreciated part of the system, I think partially because it works so well.

I do think that Jeremy makes some good points. There are some other nice things about Ruby, like being able to catch exceptions on all block-like things (such as method definitions) and the ability to retry an exception - "try to do this, except if it fails, fix something and try again." But I think that with a lot of the features that showed up in Python 2.2 (descriptors, new style classes, simple generators), the gap between Python and Ruby closed immensely. And Ruby still has too many Perl/Shell-isms. If you put something in `backticks`, it executes a shell command. I really like that Python has kept all of that functionality in the os/posix modules and out of the language core.

Posted by: J.Shell on August 20, 2003 06:17 PM

I think we're all agreed that Python is great and Ruby is almost as good. But then there are those who wouldn't program in anything but Smalltalk, Java, Perl, C++, Lisp, Brainf*ck or (insert name of language here).

I say good luck to 'em. If everyone was the same then this world would be a very dull place indeed.

I'll continue shuffling along with my Python code secure in the knowledge that its the right language *for me*.

Everything else is just trolling ;-)

Posted by: Andy Todd on August 20, 2003 07:28 PM

> If everyone was the same then this world would
> be a very dull place indeed.

Which is why, when Python does take over the world, we'll still be arguing about how many spaces constitutes a "proper" indent. And if we ever get that sorted, it'll be whether programmers caught using tabs in source files should be banned from using computers altogether or merely auto-taunted by their IDEs.

a

Posted by: Alan Green on August 21, 2003 01:41 AM

Fredrik: If you were programming in Java, you could substitute \u0054 and \u0074 for 'T' and 't' respectively, bypassing the need for those keys all together! In fact, Java is so superior that you can program effectively with more than half your keyboard broken: you just need \, a-f, u and the numeric keys!

As for backtick, as well as the other Perl throwback: magic regexp variables, that's just a stylistic/convenience thing, I guess. There's a lot to be said for "make the simple things simple".

`ps aux`.grep(/^#{username}\s+(\d+)/) { system("kill #{$1}") }

And, since backtick is just a Kernel method, if you _really_ hate it... :)

module Kernel
  def `(*args)
    raise "Don't do that!"
  end
end

Posted by: Charles Miller on August 21, 2003 02:21 AM

I have to agree with Charles about the backticks, I must say. They suck. Unfortunately, Python has them too! (String coercion.)

Alan,
I think that the indent wars are pretty much over. There may be a few tropical island dwellers who don't *know* that the war is over, but the rest of us are all using four spaces.

Andy,
Brainf*ck? Might look attractive if you are stuck with VB, I suppose, but I can't see it being anyone's language of choice.

Python's modular system is an overlooked win, I agree. I'd not really thought about it myself, I must say!

Posted by: Simon Brunning on August 21, 2003 09:22 AM

You might like to look at this new upstart langauge I found via zephyrfalcon.org:

http://www.elasticworld.org/

Posted by: Peter Bowyer on August 21, 2003 05:40 PM

urP2jw

Posted by: Aagpxpeq on July 15, 2009 01:04 PM

2atZFW Beautiful site!

Posted by: tramadol drug guide on August 3, 2009 08:56 AM
Post a comment
Name:


Email Address:


URL:



Comments:


Remember info?