Python vs Ruby

T

tony summerfelt

I think the current balance between backets and begin/end in ruby is
very good.

it might seem like that if you know ruby really well and use a lot of
the {|x| ...} syntax...

i find my code still has an inordinate amount of begin/end blocks
so my code looks amateurish compared to what i've seen here...

as i learn more efficient ruby that will diminish...
http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org
 
B

benjamin.ferrari

tony said:
ruby has what python IMHO will never have. a friendly community.
tcl/tk has it also...perl and python seem to be in the same camp when
it comes to it's users...

a few years ago i asked a question in the python newsgroup. i was
trying to port some perl code to python (which i was in the process of
learning)

it was immediatly tagged as a troll and the vitriol of the responses i
got was shocking. rudest bunch of people i've ever met online.

you can still google the responses to me:
(http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/14039)

it was in the ruby newsgroup, but written by a python person...i'm
sure a ruby programmer would never have replied like that :)

i've found that python people DO have an attitude. they don't like to
hear anything negative about their language of choice (even if it
happens to be factually true).

It seems that the ruby's community is not so friendly anymore:

I still consider myself as a part of the python community.
And you lumping me together with these people
(http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/14039) is
very offending.

I think it is really as simple as large community => many morons.

'there's only ONE way to do it'

No! The correct statement is:

'There should be one-- and preferably only one --obvious way to do it.'

the _obvious_ is very important here.

The idea behind this really makes a lot of sense (although I currently
prefer the ruby way). I tried to explain that here:

http://onthethought.blogspot.com/2005/01/thinking-in-ruby-not.html#comments
 
P

Premshree Pillai

it might seem like that if you know ruby really well and use a lot of
the {|x| ...} syntax...

i find my code still has an inordinate amount of begin/end blocks
so my code looks amateurish compared to what i've seen here...

I don't think that's right. It's just a matter of preference. Nothing
to do with how well you can program.
 
P

Premshree Pillai

yeah, that can be a killer if you don't use a fixed width font.

i found the only way to avoid that was to write python code with a dos
or some console editor (like the console version of vim, boxer, etc).

if i had any complaint about ruby it would be begin/end blocks. i
thought we ( as programmers) were done with that when pascal fell by
the wayside. i much prefer {curly brackets} to designate blocks of

Heh, you don't like indentation _and_ you don't like begin/end blocks?
The reason for having begin/end blocks is simple: the
blocks-by-indentation in Python is _good_ -- code looks really
readable; however, the problem with that was in distinguishing end of
code blocks when you have several blocks. That's solved using
begin/end blocks -- the code is as readable and at the same time
there's no end ambiguity.
 
P

Premshree Pillai

i've found that when someone becomes a 'python person' they
absolutely REFUSE to consider another language.

With all due respect, I'd disagree here. I have been a long time
Python user; I have talked about Python at conferences and stuff. Now
I educate folks about Ruby. And I _still_ use Python.

I have started liking Ruby a lot, yes. However, I must add that it
_is_ difficult for a Python user to even get motivated to learn a new
language. Had I discovered Ruby earlier, it would have been extremely
difficuly for me to think of Python.
 
T

tony summerfelt

No! The correct statement is:

'There should be one-- and preferably only one --obvious way to do it.'

what can i say:
There's Only One Way To Do It.
--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)

from:
http://mail.python.org/pipermail/python-announce-list/2000-September/000500.html


so i guess my question is: who's right with the statement you or the
author of python :)

but my comment remains the same. only python masters will know the
'obvious way ' to do it...the rest of us just get flamed for being
perl/ruby/tcl/rebol/lua programmers :/


http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org
 
T

tony summerfelt

Heh, you don't like indentation

i LIKE the indentation (it was the person i was replying to that
didn't like it). it makes you write neatly formatted code, removes
brackets/begin/end...BUT debugging a 10,000 line whitespace bug is
annoying.
_and_ you don't like begin/end blocks?

i don't like using 'begin' and 'end' i would much prefer using the
curly's for the blocks (or square brackets like rebol uses).

http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org
 
T

tony summerfelt

With all due respect, I'd disagree here.

ok, not you...

but at the time the other few dozen that sent me hatemail found ruby
a 'toy language', 'too perlish', 'too much like smalltalk', etc. and
when i mentioned that ruby might be easier to embed into a C program
than python is, the response was 'BS'. keeping in mind that i've done
both but the python person hadn't.

anyway. i'm not going round and round on this...been there done that,
got my flame re-tardant t-shirt...
http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org
 
A

Alexander Kellett

yeah, that can be a killer if you don't use a fixed width font.

i found the only way to avoid that was to write python code with a dos
or some console editor (like the console version of vim, boxer, etc).

actually, i was using vim, but without a distinction in the highlighting
for tab / space. and i have 4 space tabs ;)
if i had any complaint about ruby it would be begin/end blocks. i
thought we ( as programmers) were done with that when pascal fell by
the wayside. i much prefer {curly brackets} to designate blocks of
code...

i use {}s constantly. i find that the distinction of having
end sometimes and } sometimes (while, def, class, if) makes for
really readable code and makes it much easier to see whats a builtin
to the language, admittedly i gave in to loop {} lately, tho i think
i'll return to while true as i prefer that i think :)

Alex
 
A

Alexander Kellett

Even C++ Freaks like Björn Stroustroup don't like brackets because
they are too much overloaded, thats why the new cast operators use <>.

yup. lisp just ain't all that amazing really
and having {} instead of () isn't that great ;)
my mind parses ruby with interspersed {} and begin/end
*much* better than python / perl / c etc. they are
all too.. samey. :'s everywhere, $'s everywhere,
() / {}'s everywhere,

i'm still waiting for someone to come up with a
nicer syntax for || and some neat preprocessor/Filter
hacks to make ruby entirely non perl like for
all the perl haters out there :p
I think the current balance between backets and begin/end in ruby is
very good. In Pascal the problem was that you had if/begin/end and no
implicit begin as part of the control statement. Ruby and all later
Wirth
languages (Modula/Oberon) learned from the wrong Pascal way.

*nod*

Alex
 
A

Alexander Kellett

No! The correct statement is:

'There should be one-- and preferably only one --obvious way to do it.'

the _obvious_ is very important here.

actually, while there is some truth to this, i disagree.
there is never only one way to do something, i'm sure i can
point out multiple ways in python to do a single thing.
the fact is, different approaches are required, different
design decisions could be made, and the language should
preferably reflect these decisions well, otherwise you
end up with lots of guess work and implications.

the fact is, python ain't all that bad, but it has a lot
of duplications in its standard lib, i find the "sum" method
for example very stupid, and the duplication of method for
getting the length of a string is eww. not like in ruby
where they are exported via known alias's, but instead
*entirely* different methods for finding the value.

anyways, in the main python gets it right. just a few
shortcomings, but i'm happy to see that with 2.4 its
catching up to ruby, and in some areas, surpassing it,
the functional stuff doesn't really impress me, given
guido's background, i'm surprised there's not more,
doesn't really give it practical use cases though, list
processing via iterators etc in ruby is a neat and readable
solution to most of these problems.

perl otoh, goes very wrong, it provides many many ways
of doing the same thing. and none of them sensible :)
at least while python provides several ways, they are
in most cases, *fairly* sensible, but perl, its just
a long running joke by the authors, i'm sure of it ;)

Alex
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: Python vs Ruby"

|> The lack of English documentation was the biggest
|> (perhaps only) weakness in Ruby.
|
|Exactly. I don't see any other reason why Ruby didn't take off as well
|as Python.

I don't think so. You have more English documents than in Japanese
these days. So that the reason should be "the lack of documentation"
at most. You might know that many among open source developers are
not good document writers (including myself).

matz.
p.s.
Well, my blog is the only exception, maybe.
 
B

benjamin.ferrari

tony said:
it.'

what can i say:


http://mail.python.org/pipermail/python-announce-list/2000-September/000500.html


so i guess my question is: who's right with the statement you or the
author of python :)

good point, but what about python itself? :)


16:20:18-ferrari@herrober:~$ python
Python 2.3.3 (#1, May 18 2004, 19:29:58)
[GCC 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
putting this into the python implementation seems more official to me
than a personal signature.
 
J

James Britt

Yukihiro said:
Hi,

In message "Re: Python vs Ruby"

|> The lack of English documentation was the biggest
|> (perhaps only) weakness in Ruby.
|
|Exactly. I don't see any other reason why Ruby didn't take off as well
|as Python.

I don't think so. You have more English documents than in Japanese
these days. So that the reason should be "the lack of documentation"
at most. You might know that many among open source developers are
not good document writers (including myself).


Well, I'm inclined to blame "LAMP".

People are encouraged to use suboptimal tools for a task simply because
the tool name fits a snappy acronym.

If matz had only picked a name that began with "P", rather than "R" ...

James
 
J

James Britt

benjamin.ferrari wrote:
...
16:20:18-ferrari@herrober:~$ python
Python 2.3.3 (#1, May 18 2004, 19:29:58)
[GCC 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

The Zen of Python, by Tim Peters
...
Although that way may not be obvious at first unless you're Dutch.


"It also makes sense if you grew up Pennsylvania Dutch [...]"

Bruce Eckle, commenting on the readability of a given Ruby example.

http://onthethought.blogspot.com/2005/01/thinking-in-ruby-not.html


James
 
T

tony summerfelt

perl otoh, goes very wrong,

and i think perl6 is going to be very wronger...i wish larry wall
would stop listening to the python complains about perl...they aren't
gonna use perl6 anyway...and from the sounds of it a lot of current
perl programmers won't either...

the perl oo always felt tacked on to me...most of the perl code i
write is perl4 anyway...
it provides many many ways
of doing the same thing. and none of them sensible :)

they make sense to a perl programmer :)


http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org
 
T

tony summerfelt

On the other hand, I've read comments (not here) to the effect that the
phrase "The Ruby Way" implies that there is but one correct way to do
things (as opposed to "A Ruby Way" of doing something).

or does 'the ruby way' mean the freedom to write ruby code the way you
see fit...

larry wall has said of perl code 'if it works, then it's right' or
something along those lines)

i've written some horrendous perl code in 2 or 3 minutes but it
worked when it needed to so i was happy...
http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top