Python vs Ruby

A

Amol Vaidya

Hi. I am interested in learning a new programming language, and have been
debating whether to learn Ruby or Python. How do these compare and contrast
with one another, and what advantages does one language provide over the
other? I would like to consider as many opinions as I can on this matter
before I start studying either language in depth. Any help/comments are
greatly appreciated. Thanks in advance for your help.
 
R

Roy Smith

"Amol Vaidya said:
Hi. I am interested in learning a new programming language, and have been
debating whether to learn Ruby or Python. How do these compare and contrast
with one another, and what advantages does one language provide over the
other? I would like to consider as many opinions as I can on this matter
before I start studying either language in depth. Any help/comments are
greatly appreciated. Thanks in advance for your help.

Of all the common scripting languages, Ruby has the highest vowel to
consonant ratio.
 
J

jean-marc

I'd believe that would be Lua, but then again what is common to one
might not be to another ;-)
 
R

Roy Smith

"jean-marc said:
I'd believe that would be Lua, but then again what is common to one
might not be to another ;-)

Dang, you're right! Lua's got Ruby beat two-fold!
 
J

Jason Stitt

Dang, you're right! Lua's got Ruby beat two-fold!

And lack of vowels is definitive proof that PHP is not-so-good, right?

How can we improve Python's competitiveness in this arena? "Pie"? Or
can we do even better than Lua? Ptooey!

- Jason
 
B

Bryan

Amol said:
Hi. I am interested in learning a new programming language, and have been
debating whether to learn Ruby or Python. How do these compare and contrast
with one another, and what advantages does one language provide over the
other? I would like to consider as many opinions as I can on this matter
before I start studying either language in depth. Any help/comments are
greatly appreciated. Thanks in advance for your help.

why don't you do what i did? download ruby and spend a day or two reading
"programming ruby" from www.ruby-lang.org/en. the download python and spend a
day or two reading the python tuturial from www.python.org. they are very
similar languages and it's going to come down to your personal perference. for
me personally, ruby did not fit in my brain and python did. i used the "how
many times did i have to flip back to a previous page in the manual/tutorial and
reread a section" test. with ruby, once i got about one third of the way
through the manual, i had to constantly reread previous sections. with python,
not once did i need to reread a previous section. therefore, python was the
obvious choice for me.


bryan
 
B

Bryan

Dave said:
Cale? You mean Python has more ruffage?

Dave Cook


i think you mean "kale" not "cale". nothing like a hot bowl of tofu kale soup
while reading the recipes in the "python cookbook".

bryan
 
B

bruno modulix

Amol said:
Hi. I am interested in learning a new programming language, and have been
debating whether to learn Ruby or Python. How do these compare and contrast
with one another, and what advantages does one language provide over the
other? I would like to consider as many opinions as I can on this matter
before I start studying either language in depth. Any help/comments are
greatly appreciated. Thanks in advance for your help.

The main point about "advantages" is that Python has a larger community,
a larger choice of libraries, and is somewhat more mature (which is not
surprising since Python is a little bit older than Ruby).

Else, both are hi-level highly dynamic object oriented languages, both
are fun to program with, and both are easy to get started with. So the
best thing to do is to give both a try and go with the one that fits
your brain.

--
bruno desthuilliers
ruby -e "print '(e-mail address removed)'.split('@').collect{|p|
p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '(e-mail address removed)'.split('@')])"
 
B

beza1e1

Depends on your experience. If you know C,C++,Java and the whole
C-syntax-bunch. I'd recommend Python just to learn to adapt a different
syntax. If you want to learn for the learnings sake, i'd also recommend
Haskell to try functional programming, if you do not already know it.

Ruby has some interesting concepts, Python (well CPython) does not
have. Blocks for example, which make Continuations possible. In Python
you need stackless Python (a different implementation) to do this.
 
C

Cameron Laird

Or better: DiveIntoPython
.
.
.
You've already been told all the essentials: that they're similar,
that specific Web pages usefully contrast them, that *Dive into Python*
and so on are worth reading, ... I want to emphasize particularly the
wisdom of trying the two for yourself, to see how each fits your own
tastes. This is practical advice; it truly is possible to have a
meaningful experience with Python and/or Ruby over the course of a day.
These languages are FAR more "light-weight" than, for example, C++,
which typically requires weeks or months of practice before one truly
"gets it". While you won't know everything about, say, Ruby, in the
first four hours, you *will* be able to write programs independently,
and you'll have a "feel" for how the language works as a whole.
 
C

Casey Hawthorne

What languages do you know already?

What computer science concepts do you know?

What computer programming concepts do you know?


Have you heard of Scheme?


Ruby is a bit Perl like -- so if you like Perl, chances are you might
like Ruby.

Python is more like Java.

I have heard, but have not been able to verify that if a program is
about
10,000 lines in C++
it is about
5,000 lines in Java
and it is about
3,000 lines in Python (Ruby to?)
 
A

Amol Vaidya

Thank you for all the great information and links! I think I will do what a
lot of you reccomended and try both for myself, the only problem is finding
time with homework, college applications, and SATs coming up. I'll let you
know how it turns out. Again, thank you all for the help.
 
A

Amol Vaidya

Casey Hawthorne said:
What languages do you know already?

What computer science concepts do you know?

What computer programming concepts do you know?


Have you heard of Scheme?


Ruby is a bit Perl like -- so if you like Perl, chances are you might
like Ruby.

Python is more like Java.

I have heard, but have not been able to verify that if a program is
about
10,000 lines in C++
it is about
5,000 lines in Java
and it is about
3,000 lines in Python (Ruby to?)

I've done a lot of studying on my own, and taken the classes that my
high-school offers. I feel that I have a fairly good understanding of Java,
and basic OO concepts due to that. I've created some semi-complex programs
in java, in my opinion, such as networked checkers, 8-player blackjack, a
space-shooter type game, a copy of mario (one level, anyway), and some other
stuff. I've also done a bit of studying on C. I've done a few projects in C,
including another space-shooter type of game using SDL, an IRC client and
some simple database-type programs. I also gave a shot at assembly using
NASM for x86 before, but didn't get too far. I wrote some trivial code --
wrote to the video buffer, played with some bios interrupts, stuff like
that. The only thing I did in assembly was create a program that loads at
boot-up, and loads another program that just reiterates whatever you type
in. I only did that because I was curious. That's about as far as my
programming knowledge/experience goes.

Well, I'm not sure what you mean by programming concepts. I'm familiar with
OO through Java, and procedural programming through C. I'd be more detailed,
but I'm not exactly sure what you are asking. Sorry.

I have no idea what Scheme is, but I'll cettainly look it up as soon as I'm
done writing this.

I've never given Perl a shot. It was another language I considered learning,
but my father's friend told me to go with Python or Ruby.

Thanks for your help. Hopefully I wasn't too lengthy in this post.
 
T

Tom Anderson

Good questions!

I don't think rubyists would appreciate that description. Ruby may be
heavier on the funky symbols than python, but it's a very clean, elegant,
usable, well-thought-out and deeply object-oriented language - in other
words, nothing at all like perl.

Python is *nothing* like java.

ITYM 300. Yes, ruby too.
I've done a lot of studying on my own, and taken the classes that my
high-school offers. I feel that I have a fairly good understanding of
Java, and basic OO concepts due to that. I've created some semi-complex
programs in java, in my opinion, such as networked checkers, 8-player
blackjack, a space-shooter type game, a copy of mario (one level,
anyway), and some other stuff. I've also done a bit of studying on C.
I've done a few projects in C, including another space-shooter type of
game using SDL, an IRC client and some simple database-type programs. I
also gave a shot at assembly using NASM for x86 before, but didn't get
too far. I wrote some trivial code -- wrote to the video buffer, played
with some bios interrupts, stuff like that. The only thing I did in
assembly was create a program that loads at boot-up, and loads another
program that just reiterates whatever you type in. I only did that
because I was curious. That's about as far as my programming
knowledge/experience goes.

An excellent start!
Well, I'm not sure what you mean by programming concepts. I'm familiar
with OO through Java, and procedural programming through C. I'd be more
detailed, but I'm not exactly sure what you are asking. Sorry.

I think i know what Casey means, but i don't know if i can explain it any
better. Do you understand the concept orthogonality? The Once And Only
Once principle? Have you ever heard of design patterns?
I have no idea what Scheme is, but I'll cettainly look it up as soon as
I'm done writing this.

You won't like it. Give yourself another 5-10 years, and you might start
to find it strangely intriguing.
I've never given Perl a shot. It was another language I considered
learning, but my father's friend told me to go with Python or Ruby.

Your father has good friends.
Thanks for your help. Hopefully I wasn't too lengthy in this post.

Lengthy is fine!

Anyway, the upshot of all this is that, yes, you should learn python.
Python is dope!

tom
 
B

bonono

I don't think you really need to give to much time in weighting between
python or Ruby. Both are fine. But Python has the obvious advantage
that it has much more modules than Ruby so many things you don't need
to implement if you have real work to do.

I recommend you give haskell a shot if you are "in" to programming
because it makes you think differently, not necessary better(at least
not all the time) but helps.

I am not sure your intention but I think there isn't a one language
fits all situation here. I frequently use the following:

C/C++ - for linux kernel hacking etc., many library out there still use
it
python - generic stuff
SQL - nothing beats it for many business apps
haskell - a language to train my brain
javascript - Web front end

other than haskell and SQL, the others are more or less the same to me
so getting familiar with them is not too difficult.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,270
Messages
2,571,352
Members
48,034
Latest member
BettinaArn

Latest Threads

Top