Can you please help to make decision?

Fist of all, sorry for poor English, I am not professional English
speaker. I have some plan to do study computer language for my work. But
still I do not make decision what to do study between Ruby and Python. I
never have experience to use any computer language. I think Ruby's
design is clean, whereas it does not have many libraries to use
somebody.

Can you please help to make decision?

Byung-Hee HWANG wrote:

Fist of all, sorry for poor English, I am not professional English
speaker. I have some plan to do study computer language for my work. But
still I do not make decision what to do study between Ruby and Python. I
never have experience to use any computer language. I think Ruby's
design is clean, whereas it does not have many libraries to use
somebody.

Ruby, no question about it.

···

--
Posted via http://www.ruby-forum.com/\.

I would choose python.

1)

a clean (probably one of the cleanest) object oriented design, example:

<snip>

Convert the number 12 to a string:

ruby: my_str = 12.to_s

python: my_str = str(12)

I have a hard time understanding how either method has an advantage over
the other. It's totally irrelevant in my opinion. Personally, I think
using a number to call a method looks ugly. But I can adapt pretty
easily.

2)
- a simpler (not simple by any means, but simpler) Inheritance Model

I have never studied a simple inheritance model. I don't have enough
experience with Ruby's inheritance model yet to know which is simpler.
Once again, I think trying to decide which is simpler is totally
irrelevant--especially for a beginner who has never programmed in any
language before.

3)
- a little bit less esotheric (syntax and metraprogramming) thus what
you learn about Ruby will be more usable for other languages e.g.
Smalltalk

I think ruby's syntax looks like chicken scratchings, and I have a C++
background. C++ has the most difficult syntax I have seen--except maybe
perl's. In my opinion, python's syntax is much more human readable than
ruby's. I guess if you are coming from perl, then ruby's syntax would
seem incredibly clear. Of course, if you know a language well, it's
easy to read. I think the test is whether someone who doesn't know a
language well can make heads or tails out of what is going on in some
basic code. I don't think ruby is ever going to be readable in that way.

Ruby also relies heavily on regex's, and regex's are never going to be
easy to read for anyone. regex's are not beginner friendly, and that
might be a big barrier for a beginner trying to learn ruby. There are
lots of people who just can't learn regex's.

4)
- simpler, Python got very, very powerful but at the cost of advanced
techniques, the Ruby learning curve will be much flatter.

I doubt that Ruby's learning curve is flatter. I think python and ruby
are close neighbors as far as languages go. In fact, there are some
similarities that it will make you wonder who copied who with regard to
certain features. However, I would guess that python's learning curve
is easier for beginners because the subject of classes doesn't come up
until about the middle of a python book. python is a language that can
be used effectively without classes if the concept of classes is too
difficult for a beginner to grasp.

Overall, I think python's online documentation is pretty poor, but I
think ruby's is worse. In my opinion, only php got it right. They
opened up the online documentation to user comments, and now every
single issue that has ever been encountered with any function is
discussed in the comments to the documentation. That is incredibly
valuable information. If ruby wanted to take a significant step forward
in its online documentation relative to python, I think they should copy
the php model. One solution to the poor online docs for both ruby and
python is to buy a good book.

There is also more information about python available on the web since
the python community is much larger.

5)
- and this is my favorite: "Code Blocks", learning to use code blocks
is probably the single greatest benefit from learning Ruby, Python
just will not give this to you.

I don't know what "code blocks" are and the subject isn't in the
appendix of ruby's bible: pickaxe2, so I can't comment on that.

6) I find tracking down errors is more difficult in ruby than python.
python has better error messages. For instance, in ruby if you forget
one 'end' in your code somewhere('end' is used to terminate a section of
code), the error message will say that there is an error on the last
line of your program. As a result, you have to go hunting through your
whole program to figure out where you forgot an 'end'. That's
aggravating.

7) There are some really nice little touches that python implements,
which make programming less aggravating. I'll highlight one.

Both ruby and python have string formatting, which requires more typing
as well as typing harder to reach characters on the keyboard in order to
output some information to the screen. But let's say you just want to
quickly display something to the screen with minimal typing. In ruby,
you can use the method: puts. For instance,

val1 = 10
val2 = 20

puts val1, val2

puts adds a newline after each value, so the output is:

10
20

But, what if you want to print two things on the same line. Ruby also
has a print method:

print val1, val2

but the output will be: 1020. To get some separation, you have to do
this:

print val1, " ", val2

and then the output will be: 10 20. Having to include the quoted space
in there is almost not worth the effort--you might be swayed to use the
more laborious string formatting instead. In addition, print does not
add a newline at the end, so to keep any subsequent output from
displaying on the same line, you need to write:

print val1, " ", val2, "\n"

That's just too much of a hassle. Using puts with string formatting is
probably no harder to type:

puts "#{val1} #{val2}"

So much for being able to type something quickly that displays a few
values to the screen.

In python, the print command is like the puts method in ruby. However,
it works a little bit differently. The statement:

print val1, val2

works differently in two ways:

1) print adds a newline after all the output--not after each variable
2) print automatically adds a space between each variable

So this code:

val1 = 10
val2 = 20

print val1, val2

produces the output: 10 20, and since print automatically adds a newline
after all the output, the next print statement won't display output on
the same line. As a result, python's print statement is incredibly
handy and easy to use. I think it shows how much thought is put into
the details of the language.

8) Then there are the well documented major shortcomings of Ruby---it is
slow. Rubyists will say, "Who cares?! I'm in no rush to get the
results of my programs." That's well and good, but it's nice to have
more speed if you need it. Rubyists will counter, "If I need the speed,
I'll program in C." That's great if you know C, but what if you only
know ruby? python executes much faster than ruby, and just like ruby,
you can program the slow parts in C if you need even more speed.

Good luck with your choice.

···

--
Posted via http://www.ruby-forum.com/\.

Byung-Hee HWANG wrote:

Fist of all, sorry for poor English, I am not professional English
speaker. I have some plan to do study computer language for my work. But
still I do not make decision what to do study between Ruby and Python. I
never have experience to use any computer language. I think Ruby's
design is clean, whereas it does not have many libraries to use
somebody.

Can you please help to make decision?

I think one thing is the "fun" factor, that i have programmed in BASIC,
Assembly, Fortran, Pascal, C, C++, Perl, Python, Ruby, and PHP.

I'd say Pascal was delightful as it was well structured. C is powerful.
Perl and Python is quick for writing code. But recently I just have had
a lot of fun writing in Ruby. I haven't had that feeling in years.

···

--
Posted via http://www.ruby-forum.com/\.

Byung-Hee HWANG wrote:

Fist of all, sorry for poor English, I am not professional English
speaker.

Whoops. Maybe these will be easier to understand:

language1:

···

---------
numbers = [10, 20, 30]

numbers.each {|number| puts number}

language2:
---------
numbers = [10, 20, 30]

for number in numbers:
    print number
--
Posted via http://www.ruby-forum.com/\.

In article <1191143544.1498.1.camel@viola.izb.knu.ac.kr>,

···

Byung-Hee HWANG <bh@izb.knu.ac.kr> wrote:

Fist of all, sorry for poor English, I am not professional English
speaker. I have some plan to do study computer language for my work. But
still I do not make decision what to do study between Ruby and Python. I
never have experience to use any computer language. I think Ruby's
design is clean, whereas it does not have many libraries to use
somebody.

Can you please help to make decision?

I don't think Python has ever gained the traction that Ruby has,
especially with the advent of RoR.

My opinion, go with Ruby.

Of course 100% Ruby unless you ask the question on the Python Mailing List ;).
I however feel that if one might argue if Ruby or Python is the better
language for ages if it comes to decide which one of the both to
learn first Ruby really wins, here is my personal list why:

- a clean (probably one of the cleanest) object oriented design, example
  12.to_s (Ry) vs. str(12) (Py)
- a simpler (not simple by any means, but simpler) Inheritance Model
- a little bit less esotheric (syntax and metraprogramming) thus what
you learn about Ruby will be more usable for other languages e.g.
Smalltalk
- simpler, Python got very, very powerful but at the cost of advanced
techniques, the Ruby learning curve will be much flatter.
- and this is my favorite: "Code Blocks", learning to use code blocks
is probably the single greatest benefit from learning Ruby, Python
just will not give this to you.

This is a single opinion of a single minded guy of course ;).
Robert

···

On 9/30/07, SpringFlowers AutumnMoon <summercoolness@gmail.com> wrote:

Byung-Hee HWANG wrote:
> Fist of all, sorry for poor English, I am not professional English
> speaker. I have some plan to do study computer language for my work. But
> still I do not make decision what to do study between Ruby and Python. I
> never have experience to use any computer language. I think Ruby's
> design is clean, whereas it does not have many libraries to use
> somebody.

Ruby, no question about it.

--
what do I think about Ruby?
http://ruby-smalltalk.blogspot.com/

[...snip...]

I think ruby's syntax looks like chicken scratchings, and I have a C++
background. C++ has the most difficult syntax I have seen--except maybe
perl's. In my opinion, python's syntax is much more human readable than
ruby's. I guess if you are coming from perl, then ruby's syntax would
seem incredibly clear. Of course, if you know a language well, it's
easy to read. I think the test is whether someone who doesn't know a
language well can make heads or tails out of what is going on in some
basic code. I don't think ruby is ever going to be readable in that way.

I will refer to your comments. Thank you for serious advice.

[...snip...]

···

On Sun, 2007-09-30 at 22:47 +0900, 7stud -- wrote:

Look under 'block' not 'code block'.

Regards, Morton

···

On Sep 30, 2007, at 9:47 AM, 7stud -- wrote:

5)
- and this is my favorite: "Code Blocks", learning to use code blocks
is probably the single greatest benefit from learning Ruby, Python
just will not give this to you.

I don't know what "code blocks" are and the subject isn't in the
appendix of ruby's bible: pickaxe2, so I can't comment on that.

I would choose python.

First of all is great that somebody speaks out honestly like this, and
it will give a great discussion, looking forward to it

1)
>a clean (probably one of the cleanest) object oriented design, example:
<snip>

Convert the number 12 to a string:

ruby: my_str = 12.to_s

python: my_str = str(12)

I have a hard time understanding how either method has an advantage over
the other. It's totally irrelevant in my opinion. Personally, I think
using a number to call a method looks ugly. But I can adapt pretty
easily.

That is not really the issue, remember I was talking to a beginner.
12.to_s means it is Integer's responsibility to convert itself to a String
str(12) means it is Kernel's responsibility to convert Integer's to Strings
the second just does not feel OO to me.

2)
- a simpler (not simple by any means, but simpler) Inheritance Model

I have never studied a simple inheritance model. I don't have enough
experience with Ruby's inheritance model yet to know which is simpler.
Once again, I think trying to decide which is simpler is totally
irrelevant--especially for a beginner who has never programmed in any
language before.

Well you mean the shall start running before walking? Why not if they
are well guided, I could easily tell a beginner start with Python but
be aware of all dangers of MI. Is there good materiel like that on
Python? I guess a link would be appreciated.
In the end it might be simpler to learn walking first, but it is not a
strict rule.

3)
- a little bit less esotheric (syntax and metraprogramming) thus what
you learn about Ruby will be more usable for other languages e.g.
Smalltalk

I think ruby's syntax looks like chicken scratchings, and I have a C++
background. C++ has the most difficult syntax I have seen--except maybe
perl's. In my opinion, python's syntax is much more human readable than
ruby's. I guess if you are coming from perl, then ruby's syntax would
seem incredibly clear. Of course, if you know a language well, it's
easy to read. I think the test is whether someone who doesn't know a
language well can make heads or tails out of what is going on in some
basic code. I don't think ruby is ever going to be readable in that way.

Ok maybe I should have said that this is a personal POV, however

Ruby also relies heavily on regex's, and regex's are never going to be
easy to read for anyone. regex's are not beginner friendly, and that
might be a big barrier for a beginner trying to learn ruby. There are
lots of people who just can't learn regex's.

with all due respect that is nonsense, regexs are what they are, in
Perl, Python or Ruby.

4)
- simpler, Python got very, very powerful but at the cost of advanced
techniques, the Ruby learning curve will be much flatter.

I doubt that Ruby's learning curve is flatter. I think python and ruby
are close neighbors as far as languages go. In fact, there are some
similarities that it will make you wonder who copied who with regard to
certain features. However, I would guess that python's learning curve
is easier for beginners because the subject of classes doesn't come up
until about the middle of a python book.

And that is to late IMHO,

python is a language that can
be used effectively without classes if the concept of classes is too
difficult for a beginner to grasp.

Yes but should they, I guess a pure question of taste, but I give
partially in on it.
Might really depend on the student's style.

Overall, I think python's online documentation is pretty poor, but I
think ruby's is worse.

Ok no discussion here, I give you that point
But the Ruby community seems more helpful than Python's, do you agree?
<PHP stuff snipped>

There is also more information about python available on the web since
the python community is much larger.

yes but see above

5)
- and this is my favorite: "Code Blocks", learning to use code blocks
is probably the single greatest benefit from learning Ruby, Python
just will not give this to you.

I don't know what "code blocks" are and the subject isn't in the
appendix of ruby's bible: pickaxe2, so I can't comment on that.

What? Are you sure I mean {} and do end

6) I find tracking down errors is more difficult in ruby than python.
python has better error messages. For instance, in ruby if you forget
one 'end' in your code somewhere('end' is used to terminate a section of
code), the error message will say that there is an error on the last
line of your program. As a result, you have to go hunting through your
whole program to figure out where you forgot an 'end'. That's
aggravating.

I give it to you for Syntax errors, but when it come to Stack Traces
OMG Ruby beats Python by magnitudes.

7) There are some really nice little touches that python implements,
which make programming less aggravating. I'll highlight one.
<snip>

No please not that, that is not important, whoever does not implement
that kind of basic method his way anyway, and for a beginner,
really...

8) Then there are the well documented major shortcomings of Ruby---it is
slow.

I think it is fast, it is even lightening fast for a beginner for
whome typing speed is much more important than execution speed.

Rubyists will say, "Who cares?! I'm in no rush to get the
results of my programs."

Yup they will :slight_smile:

That's well and good, but it's nice to have
more speed if you need it. Rubyists will counter, "If I need the speed,
I'll program in C." That's great if you know C, but what if you only
know ruby? python executes much faster than ruby, and just like ruby,
you can program the slow parts in C if you need even more speed.

Now I am making a brisk statement: Somebody learning Ruby today will
have as fast Rubies available as Pythons, when she is master.

Good luck with your choice.

And again I agree 100% with you :wink:

Robert

···

On 9/30/07, 7stud -- <dolgun@excite.com> wrote:
--
what do I think about Ruby?
http://ruby-smalltalk.blogspot.com/

If you are not the best at English, I would suggest Ruby.

Personally, I find Pythons documentation boring and dull, but good if you are
familiar with programming (and English). Ruby, is a little more newbie
friendly in my humble opinion when it comes to documentation. Although I don't
meant to insult any one (and I would actually like to help improve it some
day), I think Ruby's documentation is not as good quality as Pythons -- but is
more then suitable for *most* things.

I think ruby's syntax looks like chicken scratchings, and I have a C++
background. C++ has the most difficult syntax I have seen--except maybe
perl's. In my opinion, python's syntax is much more human readable than
ruby's. I guess if you are coming from perl, then ruby's syntax would
seem incredibly clear. Of course, if you know a language well, it's
easy to read. I think the test is whether someone who doesn't know a
language well can make heads or tails out of what is going on in some
basic code. I don't think ruby is ever going to be readable in that way.

Ruby also relies heavily on regex's, and regex's are never going to be
easy to read for anyone. regex's are not beginner friendly, and that
might be a big barrier for a beginner trying to learn ruby. There are
lots of people who just can't learn regex's.

The C side of the syntax is easy, C++ just complicates it ^_^. My first
language was C++, I know the most about standard C of any language. But I
don't know C++ very well any more.

I've always found most languages to be fairly readable if some times hard to
follow the *specifics* of some things without knowing more about the language.
For example, if I didn't know about Blocks in Ruby, I might not get it until
after I had examined several examples. Much the same as Joe Blow probably
wouldn't know what on earth a Union is in C/C++ without knowing about them.
But understanding the struct idea is not to hard if your mind can grasp struct
= short for structure.

I've found Ruby very good for producing human readable code, it's not
*perfect* but works pretty nice in my experience. And this is coming from a
C99 Lover with a very nit picky convention for naming things ^_^.

TerryP.

···

--
    
Email and shopping with the feelgood factor!
55% of income to good causes. http://www.ippimail.com

[...]

Ruby also relies heavily on regex's, and regex's are never going to be
easy to read for anyone. regex's are not beginner friendly, and that
might be a big barrier for a beginner trying to learn ruby. There are
lots of people who just can't learn regex's.

Those are probably the same people who can't figure out
what a code block is. Even little old Awk relies heavily on
regular expressions, which should be learned by anyone who
wants to rise above COBOL and BASIC and C.

[...]

5)
- and this is my favorite: "Code Blocks", learning to use code blocks
is probably the single greatest benefit from learning Ruby, Python
just will not give this to you.

I don't know what "code blocks" are and the subject isn't in the
appendix of ruby's bible: pickaxe2, so I can't comment on that.

Zounds!

And yet the soul, shut up in her dark room,
Viewing so clear abroad, at home sees nothing;
But, like a mole in earth, busy and blind,
Works all her folly up, and casts it outward
To the world's open view.
  ---Dryden

[...]

7) There are some really nice little touches that python implements,
which make programming less aggravating. I'll highlight one.

Both ruby and python have string formatting, which requires more typing
as well as typing harder to reach characters on the keyboard in order to
output some information to the screen. But let's say you just want to
quickly display something to the screen with minimal typing. In ruby,
you can use the method: puts. For instance,

val1 = 10
val2 = 20

puts val1, val2

puts adds a newline after each value, so the output is:

10
20

But, what if you want to print two things on the same line. Ruby also
has a print method:

print val1, val2

but the output will be: 1020. To get some separation, you have to do
this:

print val1, " ", val2

and then the output will be: 10 20. Having to include the quoted space
in there is almost not worth the effort--you might be swayed to use the
more laborious string formatting instead. In addition, print does not
add a newline at the end, so to keep any subsequent output from
displaying on the same line, you need to write:

print val1, " ", val2, "\n"

That's just too much of a hassle. Using puts with string formatting is
probably no harder to type:

puts "#{val1} #{val2}"

So much for being able to type something quickly that displays a few
values to the screen.

In python, the print command is like the puts method in ruby. However,
it works a little bit differently. The statement:

print val1, val2

works differently in two ways:

1) print adds a newline after all the output--not after each variable
2) print automatically adds a space between each variable

So this code:

val1 = 10
val2 = 20

print val1, val2

produces the output: 10 20, and since print automatically adds a newline
after all the output, the next print statement won't display output on
the same line. As a result, python's print statement is incredibly
handy and easy to use. I think it shows how much thought is put into
the details of the language.

Apparently, Ruby gives the programmer more power here.
Just as Awk has OFS (output-field-separator) and ORS
(output-record-separator), Ruby has $, and $\.

E:\Ruby>irb --prompt xmp
print 88,99
8899 ==>nil
$, = ' '
    ==>" "
print 88,99
88 99 ==>nil
$\ = "\n"
    ==>"\n"
print 88,99
88 99
    ==>nil
$, = '--'
    ==>"--"
print 88,99
88--99
    ==>nil
$\ = "<<\n"
    ==>"<<\n"
print 88,99
88--99<<
    ==>nil

···

On Sep 30, 8:47 am, 7stud -- <dol...@excite.com> wrote:

7stud -- wrote:

I would choose python.

1)

a clean (probably one of the cleanest) object oriented design, example:

<snip>

Convert the number 12 to a string:

ruby: my_str = 12.to_s

python: my_str = str(12)

I have a hard time understanding how either method has an advantage over
the other. It's totally irrelevant in my opinion. Personally, I think
using a number to call a method looks ugly. But I can adapt pretty
easily.

if viewed as "hey number 12, i give you a message, and the message is
'tell me what you are in a string format', and the number 12 tells you",
that's be kind of cool.

···

--
Posted via http://www.ruby-forum.com/\.

7stud -- wrote:

Byung-Hee HWANG wrote:
>
> Fist of all, sorry for poor English, I am not professional English
> speaker.
>

Whoops. Maybe these will be easier to understand:

language1:
---------
numbers = [10, 20, 30]

numbers.each {|number| puts number}

language2:
---------
numbers = [10, 20, 30]

for number in numbers:
    print number

numbers = [10, 20, 30]
    ==>[10, 20, 30]

for number in numbers do
  p number
end
10
20
30

I'm staying out of the Ruby vs. Python debate, but the above is just plain wrong and I wish people would stop saying things like this.

For some reason, regular expressions are surrounded in this aura of mystery. Perhaps their syntax heavy nature makes them seem odd to people unfamiliar with them at first glance, but for some reason many, many people believe things like the comment posted about. That's a real shame.

Regular expression is a simple pattern language anyone can learn quite easily. I once taught them to my wife in the space of evening, to help with a work project. She's an above average skill-level computer user, but definitely not a programmer. She had no trouble grasping the concepts and still uses regular expression to this day.

Please, sit down and really try learning regular expression before adding to the fear factor surrounding them. I promise, it's time well spent.

James Edward Gray II

···

On Sep 30, 2007, at 8:47 AM, 7stud -- wrote:

Ruby also relies heavily on regex's, and regex's are never going to be
easy to read for anyone. regex's are not beginner friendly, and that
might be a big barrier for a beginner trying to learn ruby. There are
lots of people who just can't learn regex's.

Huh? Python's got lots of traction! Just not the buzz.
Python is widely used and shipped with systems.

Try both.
Go with the one that suits you best!
You have many things to consider. Browse the books and sites for all languages you're considering.
A bad book can be a big turn-off to a good language.

You can't go wrong with either one.

···

On Oct 1, 2007, at 12:20 AM, David Orriss Jr wrote:

In article <1191143544.1498.1.camel@viola.izb.knu.ac.kr>,
Byung-Hee HWANG <bh@izb.knu.ac.kr> wrote:

Fist of all, sorry for poor English, I am not professional English
speaker. I have some plan to do study computer language for my work. But
still I do not make decision what to do study between Ruby and Python. I
never have experience to use any computer language. I think Ruby's
design is clean, whereas it does not have many libraries to use
somebody.

Can you please help to make decision?

I don't think Python has ever gained the traction that Ruby has,
especially with the advent of RoR.

My opinion, go with Ruby.

I would choose python.

1)
>a clean (probably one of the cleanest) object oriented design, example:
<snip>

Convert the number 12 to a string:

ruby: my_str = 12.to_s

python: my_str = str(12)

I have a hard time understanding how either method has an advantage over
the other. It's totally irrelevant in my opinion. Personally, I think
using a number to call a method looks ugly. But I can adapt pretty
easily.

Technically, you're using "to_s" to call a method -- but you're sending
the "to_s" message to the "12" object. From an object-oriented
perspective, the 12.to_s syntax is more consistent than the str(12)
syntax -- which is probably the point the previous comment meant to make.

2)
- a simpler (not simple by any means, but simpler) Inheritance Model

I have never studied a simple inheritance model. I don't have enough
experience with Ruby's inheritance model yet to know which is simpler.
Once again, I think trying to decide which is simpler is totally
irrelevant--especially for a beginner who has never programmed in any
language before.

I think a simpler inheritance model could be of great value to someone
who has never done OOP before -- because a simpler inheritance model
should translate into a shallower learning curve. That's usually the
case with simpler things.

On the other hand, I'm not familiar enough with Python's inheritance
model to be able to make any personal judgment about which is simpler.
For all I know, I may have just made a case for learning Python first,
even though I don't much like the language.

3)
- a little bit less esotheric (syntax and metraprogramming) thus what
you learn about Ruby will be more usable for other languages e.g.
Smalltalk

I think ruby's syntax looks like chicken scratchings, and I have a C++
background. C++ has the most difficult syntax I have seen--except maybe
perl's. In my opinion, python's syntax is much more human readable than
ruby's. I guess if you are coming from perl, then ruby's syntax would
seem incredibly clear. Of course, if you know a language well, it's
easy to read. I think the test is whether someone who doesn't know a
language well can make heads or tails out of what is going on in some
basic code. I don't think ruby is ever going to be readable in that way.

I disagree quite a lot. I find Ruby's syntax marginally cleaner than
Python's, and Perl's only marginally less clean than Python's. I also
find that for me, personally, Python's syntax is eye-stabbingly
disconcerting and somewhat obtuse at times (e.g., excessive requirements
for explicit references to self), though I realize that's in large part a
result of personal preference. Even leaving the personal preference
aside, however, I still think Ruby's syntax is just a touch cleaner,
except perhaps in areas where "cleaner" translates to "missing
something".

I found Ruby much easier to reason through without having to already know
the language than Python, back when I knew neither -- despite the fact
that Python is full of function(arg) to mix in with the object.method,
while Ruby is more consistently object.method, and I was nowhere near as
familiar with object.method syntax as I was with function(arg) syntax at
the time. Your mileage obviously varies.

In fact, in many ways, I think Python's syntax is more Perl-like than
Ruby's. Leading sigils on variable names are not the only signs of
similar syntactic design, y'know -- and, in fact, are among the most
superficial and easily ignored of those signs.

Ruby also relies heavily on regex's, and regex's are never going to be
easy to read for anyone. regex's are not beginner friendly, and that
might be a big barrier for a beginner trying to learn ruby. There are
lots of people who just can't learn regex's.

Uh . . . what?

  1. I find regexen very easy to read. I guess I must not be part of
  "anyone".

  2. Ruby doesn't "rel[y] heavily" on regexen. It provides regex
  capabilities with a very simple, easy-to-use syntax that doesn't
  require obtuse library calls the way Python does, thus making regex use
  less painful. As a result, people probably make use of the power of
  the regex more often in Ruby than in Python -- not because writing Ruby
  somehow magically requires you to use regexen more often, but because
  there's less reason to avoid them since they're easier to use.

I have yet to see anything that would lead me to believe that one must
use regexen more often in Ruby than in Python. I just see more hurdles
in the way of using them in Python than in Ruby, when they're appropriate
for use.

4)
- simpler, Python got very, very powerful but at the cost of advanced
techniques, the Ruby learning curve will be much flatter.

I doubt that Ruby's learning curve is flatter. I think python and ruby
are close neighbors as far as languages go. In fact, there are some
similarities that it will make you wonder who copied who with regard to
certain features. However, I would guess that python's learning curve
is easier for beginners because the subject of classes doesn't come up
until about the middle of a python book. python is a language that can
be used effectively without classes if the concept of classes is too
difficult for a beginner to grasp.

You had me until you started talking about classes. Ruby can be very
easily used in a superficially imperative/procedural style, same as
Python. Just create global methods and use them as if they were plain
ol' procedural functions. I don't see where you get the impression that
one must necessarily jump right into defining classes, unless you've just
seen that most Ruby books tackle classes early.

Of course, the reason most Ruby books tackle classes early is that for
languages like Ruby and Python it's usually *better* to do proper OO
programming than to pick up the scalpel and try to use it to hammer
nails. I think it's a *good* thing to tackle classes sooner rather than
later in either Ruby or Python, as long as it's handled reasonably well,
because neither language really comes into its own without using object
oriented programming techniques *well*.

Why teach someone to write BASIC using Python or Ruby?

Overall, I think python's online documentation is pretty poor, but I
think ruby's is worse. In my opinion, only php got it right. They
opened up the online documentation to user comments, and now every
single issue that has ever been encountered with any function is
discussed in the comments to the documentation. That is incredibly
valuable information. If ruby wanted to take a significant step forward
in its online documentation relative to python, I think they should copy
the php model. One solution to the poor online docs for both ruby and
python is to buy a good book.

Oh, gawd, no. I agree that both Python and Ruby documentation
desperately needs some help, and I agree that having (separate, but
associated) user comment documentation is a great idea, but much of what
I've seen for PHP documentation is crap. The "official" documentation
tends to be of better quality in Ruby and Python than in PHP and, while
the user comment documentation is an important addition to the official
documentation, it's also a little bit more *needed*.

I haven't used online Python documentation enough to have an opinion
about how it compares to online Ruby documentation, I'm afraid. You may
very well be right that Python's is better, in general. On the other
hand, Perl's online documentation puts both of them to shame, by a wide
enough margin that it has time left to make the documentation of a bunch
of other languages look crappy by comparison at the same time, all while
having a nice leisurely cup of tea.

Maybe both Ruby and Python could learn from Perl's documentation as well.

There is also more information about python available on the web since
the python community is much larger.

I rather suspect the gap in community sizes is shrinking, and while I
don't know personally whether your estimation of the quantity of Python
information online compared with that of Ruby is accurate, I do know that
I've never felt like there wasn't *enough* information about Ruby.
There's a *lot* of information about Ruby online, and past a certain
point it doesn't matter much which has a few hundred extra documents
available online.

5)
- and this is my favorite: "Code Blocks", learning to use code blocks
is probably the single greatest benefit from learning Ruby, Python
just will not give this to you.

I don't know what "code blocks" are and the subject isn't in the
appendix of ruby's bible: pickaxe2, so I can't comment on that.

Try looking for "block" in the index. That'd probably help. The syntax
of a (code) block in Ruby tends to look like one of the following two
examples:

  1. object.method { |var| var.method }

  2. object.method do |var|
        var.method
      end

6) I find tracking down errors is more difficult in ruby than python.
python has better error messages. For instance, in ruby if you forget
one 'end' in your code somewhere('end' is used to terminate a section of
code), the error message will say that there is an error on the last
line of your program. As a result, you have to go hunting through your
whole program to figure out where you forgot an 'end'. That's
aggravating.

I have seen errors just as annoying for Python indentation mistakes.
I've seen, for instance, code that offers no errors at all and simply
executes in an unintended manner thanks to indentation mistakes. I don't
think either language really "wins" in terms of loop termination errors
and the like.

7) There are some really nice little touches that python implements,
which make programming less aggravating. I'll highlight one.

<snip some stuff about puts vs. print in Ruby vs. Python>

This looks like a wash, to me -- with the most common cases making Ruby a
little easier. Space-separated collections of output from separate
variables are much, much less common than newline-separated, in my
experience, though if you deal with space characters as delimiters I can
see how you might find Ruby's behavior slightly annoying. I find it more
convenient.

On the other hand, you could always do something with an iterator block
in Ruby, perhaps defining a method if you have to output a *lot* of
space-separated collections of output from variables in a given program.

I suspect there may be a built-in global variable in Ruby you can set to
get your desired behavior, too -- but I'm not sure, and wouldn't know
what it is if so (since it's not behavior I tend to desire). Does anyone
out there know for sure whether there is such a beast?

8) Then there are the well documented major shortcomings of Ruby---it is
slow. Rubyists will say, "Who cares?! I'm in no rush to get the
results of my programs." That's well and good, but it's nice to have
more speed if you need it. Rubyists will counter, "If I need the speed,
I'll program in C." That's great if you know C, but what if you only
know ruby? python executes much faster than ruby, and just like ruby,
you can program the slow parts in C if you need even more speed.

Slow:

  1. Sometimes, it's slower than Python. Others, it's faster, as
  demonstrated with a simple string concatenation exercise in a recent
  thread right here in ruby-talk. It went something like this:

    #!/usr/bin/env ruby
    i = 0
    string_var = ''
    while input = gets
      i += 1
      string_var << input
      puts(i) if i % 1000 == 0
    end

    #!/usr/bin/env python
    i = 0
    string_var = ''
    for input in sys.stdin:
      i += 1
      string_var += input
      if i % 1000 == 0: print i

  In case it's not clear, Ruby won that little performance. (Disclaimer:
  I did that from memory, and may have misremembered some specifics of
  the example code.)

  2. Sometimes, code execution speed doesn't matter that much.

  3. Ruby 1.9 is reportedly much, *much* faster than Ruby 1.8.x, so you
  may very quickly find your statements about how slowly Ruby executes
  "obsolete".

  4. There's a small enough difference between Ruby and Python that I
  really don't understand why anyone would give that much of a damn about
  which of the two is faster anyway. If you really want to compare
  execution speed, put your language of choice up against OCaml, C, or
  even assembly language.

Others may have opinions that differ from mine, of course.

···

On Sun, Sep 30, 2007 at 10:47:42PM +0900, 7stud -- wrote:

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Ben Franklin: "As we enjoy great Advantages from the Inventions of others
we should be glad of an Opportunity to serve others by any Invention of
ours, and this we should do freely and generously."

Thank you for kindness..

Byung-Hee

···

On Sun, 2007-09-30 at 19:19 +0900, Robert Dober wrote:

On 9/30/07, SpringFlowers AutumnMoon <summercoolness@gmail.com> wrote:
> Byung-Hee HWANG wrote:
> > Fist of all, sorry for poor English, I am not professional English
> > speaker. I have some plan to do study computer language for my work. But
> > still I do not make decision what to do study between Ruby and Python. I
> > never have experience to use any computer language. I think Ruby's
> > design is clean, whereas it does not have many libraries to use
> > somebody.
>
> Ruby, no question about it.
Of course 100% Ruby unless you ask the question on the Python Mailing List ;).
I however feel that if one might argue if Ruby or Python is the better
language for ages if it comes to decide which one of the both to
learn first Ruby really wins, here is my personal list why:

- a clean (probably one of the cleanest) object oriented design, example
  12.to_s (Ry) vs. str(12) (Py)
- a simpler (not simple by any means, but simpler) Inheritance Model
- a little bit less esotheric (syntax and metraprogramming) thus what
you learn about Ruby will be more usable for other languages e.g.
Smalltalk
- simpler, Python got very, very powerful but at the cost of advanced
techniques, the Ruby learning curve will be much flatter.
- and this is my favorite: "Code Blocks", learning to use code blocks
is probably the single greatest benefit from learning Ruby, Python
just will not give this to you.

This is a single opinion of a single minded guy of course ;).
Robert

Robert Dober wrote:

I would choose python.

First of all is great that somebody speaks out honestly like this, and
it will give a great discussion, looking forward to it

(-;

(2 years of pure Python, folks, and not going back...)

···

--
  Phlip

Look under 'block' not 'code block'.

Ahh. "Blocks" as in "Proc's and blocks".

That is not really the issue, remember I was talking to a
beginner. 12.to_s means it is Integer's responsibility to
convert itself to a String str(12) means it is Kernel's
responsibility to convert Integer's to Strings

Do you really think a beginner cares about that or even has any idea
what you are talking about?

the second just does not feel OO to me.

What about when you write:

puts result
input = gets
p = lambda {"hello world"}
printf("%.2f \n", 4.56789)
require "somefile"
sleep(2)

Do you avoid those 'global' method calls because they look too much like
str(12)? Or, to maintain your OO purity do you write things like:

Kernel.puts "hello world"

I give it to you for Syntax errors, but when it come to Stack Traces
OMG Ruby beats Python by magnitudes.

def func1
  func2
end

def func2
  puts y
end

func1

ruby:

···

-----
r8test.rb:5:in `func2': undefined local variable or method `y' for
main:Object (NameError)
        from r8test.rb:2:in `func1'
        from r8test.rb:7

python:
-------
Traceback (most recent call last):
  File "6test.py", line 8, in ?
    func1()
  File "6test.py", line 2, in func1
    func2()
  File "6test.py", line 5, in func2
    print y
NameError: global name 'y' is not defined

I don't see any substantive difference, but to my eye the python output
looks more orderly and is easier to read.

Personally, I find Pythons documentation boring and dull,
but good if you are familiar with programming (and English).

That's more credit than I'd give it!
--
Posted via http://www.ruby-forum.com/\.