Why Ruby over Python?

Besides ROR, can you give me a reason why perfer ruby instead of
python?

seems to many users, they are very similar in nature…

such as

  1. non C or Java style syntax
  2. focus on codes readability, not like Perl

As a longtime Perler, I dislike Python’s significant whitespace. That’s
why
I could never go for it. Ruby just feels right to me. I enjoy writing
it
and it feels liberating when I do.

I still like Perl, but Ruby is quickly winning me over.

On 7/8/06, [email protected] [email protected] wrote:

Besides ROR, can you give me a reason why perfer ruby instead of
python?

http://www.google.com/search?q=ruby+versus+python

Hi –

On Sun, 9 Jul 2006, Troy D. wrote:

As a longtime Perler, I dislike Python’s significant whitespace. That’s why
I could never go for it. Ruby just feels right to me. I enjoy writing it
and it feels liberating when I do.

I still like Perl, but Ruby is quickly winning me over.

Let’s be clear about this, though: people are allowed to like and
use more than one language :slight_smile: This is a point that sometimes gets
obscured in these “winner-take-all” language comparison discussions.

David

[email protected] wrote:

Besides ROR, can you give me a reason why perfer ruby instead of
python?

seems to many users, they are very similar in nature…

such as

  1. non C or Java style syntax
  2. focus on codes readability, not like Perl

Go ask this same question over on comp.lang.python and you’ll see why
you might prefer ruby.

[email protected] wrote:

Besides ROR, can you give me a reason why perfer ruby instead of
python?

seems to many users, they are very similar in nature…

such as

  1. non C or Java style syntax
  2. focus on codes readability, not like Perl

Hi,

I’m sticking my neck out here a bit, since I’m relatively new to Ruby,
but gonna do it anyway … :0) [I do have a good amount of experience in other languages like Java, C, Python]. More knowledgeable Rubyists,
feel free to flame away at what I say below :slight_smile: I know I’ll learn
something from it anyway.

Reason 0: First of all, its not necessarily a matter of preferring Ruby
over Python. Its not an either-or situation at all - unless you want
to make it one. Its quite possible to learn and work with more than one
language at the same time, or at least in a staggered/parallel manner.
Many top developers are of the view that learning and using more than
one language is beneficial, helps you grow as a programmer. I believe
that myself. Dave T. recently spoke at a No Fluff Just Stuff
interview on this point. I heard the MP3 - it was good. Don’t have the
URL right now, try Googling for keywords like +“Dave T.” + “NFJS”
or variants.

Reason 1: Ruby is more object-oriented than Python.

Reason 2: The Principle of Least Surprise. You can, to a good extent,
almost figure out how parts of the language / syntax work, after you’ve
learnt a bit of it. Read the Pickaxe and other Ruby books and the docs
to see more on what this means.
I’ve been writing some Ruby code and can attest to it.

Reason 3: No indentation rules like in Python. Just open the logical
construct like if or while with its corresponding keyword (“if” /
“while”), close it with “end”. Though I’m an experienced developer and
a very good typist, Python’s syntax rules recently almost drove me mad,
trying to track down an elusive bug that was related to indentation.
The rules of indentation themselves are straightforward enough. The
problem arises when you accidentally, say, mix spaces and tabs, or, if
you’re not using tabs (which is probably better), put in one more or
less space - stuff like that. This was not the problem in my case,
since I consistently use tabs. The problem arose - I think - because I
was switching text editors (Metapad and GVim on windows) at times in a
coding session. This somehow led to the changing of some tabs to
spaces. Hard to detect visually in a Windows style editor like Metapad.
Using the “:se list” option in GVim can help, but it still takes time
to track down and change all those spaces back to tabs. One can argue
away that one should not change editors in the middle of a session,
etc., but the point is that this problem simply would not happen in
Ruby, even if you switch editors midway.

Though I like Python a lot, this is one reason why I’m moving some of
my work to Ruby.
[ I finally did manage to identify and fix the problem. ]

I’m sure you’ll get some other replies, which I’ll read with interest

HTH
Vasudev

On Jul 8, 2006, at 19:08, [email protected] wrote:

obscured in these “winner-take-all” language comparison discussions.
Indeed, I am a dynamic languages enthusiast. Perl specialist by
historical accident, that’s the one I learned the firt. But very
happy to code in either Python or Ruby. My Perl module Acme::Pythonic
is kind of a joke about these “dualities”.

– fxn

[email protected] wrote:

I still like Perl, but Ruby is quickly winning me over.

Let’s be clear about this, though: people are allowed to like and
use more than one language :slight_smile: This is a point that sometimes gets
obscured in these “winner-take-all” language comparison discussions.

Don’t be a party pooper.

Next thing you know, people will start thinking it’s OK to like and use
more than one Web framework, or more than one editor, or more than one
OS.

And what fun would that be?


James B.

“You harmonize; then you customize.”

  • Wilson Pickett

James B. wrote:

use more than one Web framework, or more than one editor, or more than
one OS.

And what fun would that be?
Wait a minute … there’s another OS? This changes everything!

M. Edward (Ed) Borasky

I got into Ruby because of Rails. I like Ruby because of the
readability, funcitonality, and object oriented approach not to mention
the integration with Rails. Perl is great and has a bunch of
packages/support because its been around a bit longer. I just finished
reading David Black’s book about RoR and it increased my interest in
Ruby considerably. I guess to sum it up… less headache’s >_<

_Steve

On Sat, 8 Jul 2006 [email protected] wrote:

Besides ROR, can you give me a reason why perfer ruby instead of
python?

Did you see the lovely young ladies (I hope you know who you are) at the
last RubyConf?

– Matt
It’s not what I know that counts.
It’s what I can remember in time to use.

Matt L. wrote:

On Sat, 8 Jul 2006 [email protected] wrote:

Besides ROR, can you give me a reason why perfer ruby instead of
python?

Did you see the lovely young ladies (I hope you know who you are) at
the last RubyConf?
And … which would you give a lovely young lady – a ruby or a
dangerous reptile?

:slight_smile:


M. Edward (Ed) Borasky

On 7/8/06, M. Edward (Ed) Borasky [email protected] wrote:

And … which would you give a lovely young lady – a ruby or a
dangerous reptile?

I got yer snake right heah, baby!

As someone who has used both languages for various projects I would say
that I honestly have more fun programming in Ruby. It fits the way I
think better and therefore is more intuitive than Python IMHO. The
languages are similar in nature and if you learn one then learning the
other shouldn’t be too tough. The other external factor (other than
personal experience) is the community. As others have posted the Ruby
community is active, helpful, patient, and funny. Not every language
necessarily can say that…

unknown wrote:

Besides ROR, can you give me a reason why perfer ruby instead of
python?

seems to many users, they are very similar in nature…

such as

  1. non C or Java style syntax
  2. focus on codes readability, not like Perl

They are both excellent so you will not be unhappy with either.

The significant whitespace was really the decider for me personally.

Michael G. wrote:

  1. focus on codes readability, not like Perl

They are both excellent so you will not be unhappy with either.

There are differences in development philosophy among the two
communities, though. For example, both Python and Ruby allow running
code to alter existing classes, including core classes (though I do not
know if they are equivalent in options and effect).

The Python community is likely to look down on this, calling it “monkey
patching.” In the Ruby community this is simply one of many techniques
for building applications and is pretty common.

Ultimately the language is yours to use as you please, but it helps to
have a community with a sense of design and development that matches
your own, one that will help you grow in the direction you prefer.

The significant whitespace was really the decider for me personally.

Ruby has significant white space, too. But no significant indentation
(or, as I tend to think of it, “static indentation.”)


James B.

“A language that doesn’t affect the way you think about programming is
not worth knowing.”

  • A. Perlis

On Jul 8, 2006, at 11:21 PM, James B. wrote:

Ruby has significant white space, too. But no significant
indentation (or, as I tend to think of it, “static indentation.”)

Significant whitespace in ruby? Perhaps you mean “\n” as a statement
terminator? Are there any other examples?

From: “Logan C.” [email protected]

On Jul 8, 2006, at 11:21 PM, James B. wrote:

Ruby has significant white space, too. But no significant
indentation (or, as I tend to think of it, “static indentation.”)

Significant whitespace in ruby? Perhaps you mean “\n” as a statement
terminator? Are there any other examples?

ruby -we “puts (‘hi’)”

-e:1: warning: (…) interpreted as grouped expression
hi

Regards,

Bill

Okay, I’ve attracted to Ruby because of RoR. But, I’ve learned that Ruby
is much more than that.

  1. It supports blocks: I’ve heard that Python will support this, but I
    couldn’t find
    any explanation regarding that in Python Tutorial.

  2. OOP style codes: I hate mentioning self everytime I want to instance
    methods.

  3. quit: I can quit irb using ‘quit’. Python urges me to press CTRL+D
    though
    it knows
    that I want to quit.

  4. inject: inject is very interesting and powerful. I don’t know how
    python
    programmers
    are handling the situtation where inject fits.

Sincerely,
Minkoo S.

Logan C. wrote:

Significant whitespace in ruby? Perhaps you mean “\n” as a statement
terminator? Are there any other examples?

“” +"".to_s +""

which gives syntax error, not undefined +@ for String runtime error :wink:

lopex