Joe Van Dyk wrote:
Which is better, Python or Ruby?
(ha, just kidding)
I've been fighting the good fight inside a really large corporation
trying to get Ruby on the "approved" list. I've brought this up a
couple times in the past on this list and have got some good
responses.
Yesterday I had to give a short presentation to the big boss about Ruby and why I had chosen to use it at our company (and why I wanted to continue using it).
As there's an interest in reducing variability in software systems in
the company, any addition to the approved list has to have some pretty
good reasons as to why the addition is needed.
I have a similar issue, I had been using both Python and Ruby for my programming needs and was told by my boss that I would have to pick one and use it exclusively.
I don't think that's enough though, as #2 is pretty subjective and
there's probably an equivalent to DRb in Python and Rails is probably
way too bleeding edge (and I don't do web development stuff here). #1
is probably the most compelling reason.
I'm not so sure you will find an equivalent to DRb in Python. I have looked. Oh, there are a couple of similar libraries in Python, but I did not find them nearly as easy to use as DRb (of course, I'm not the sharpest tack in the box).
I obviously don't want to push for Ruby as a replacement for Python,
that would never work. I'm pushing for Ruby to be available for use
in addition to Python. So, I think the question is: "Why would you
want to use Ruby in a situation where Python is available?"
Boy, isn't that the $64,000 question. I struggled with this one at my job for months, as my boss put more and more pressure on me to choose one and only one.
Because I have developed a moderately complex library (KirbyBase) in first Python and then Ruby, I'm hoping that you will find my $.02 worth on this topic interesting.
To me, from a practical programming perspective (say that 10 times fast), Python and Ruby are *very* similar. Obvious differences are of course, things like the indentation thing; Ruby feeling more like object-orientated stuff was baked in rather than added on; Python being a little faster, etc.
I went back and forth trying to decide. What finally sold me on Ruby was a feature that I had little use for until Hal Fulton helped the light bulb to go on above my head. Blocks! More specifically, blocks used as closures.
Hal convinced me to rewrite KirbyBase and allow the user to specify query syntax using blocks. When I finally figured out how easy it was to add this functionality and how much power it gave the user to specify queries, I was sold.
What really put me over the top was when I recently went back and rewrote the Python version of KirbyBase and tried to duplicate all of the functionality of the new Ruby version. Python doesn't have blocks. It has lambda, but it is pretty crippled. In Python, a lambda can only be one expression and you can't do assignment in a lambda. What's worse, Guido doesn't even like lambda and he is planning on removing it from the language.
Now, you can still do closures in Python by actually passing a named function, but using blocks is just so much more elegant.
Before this, I had *used* blocks for things like #collect and #each. But it was only when I started having my own user-defined methods accept and use blocks that I really started to understand how powerful they make Ruby.
Anyway, sorry for the long post. To make a long story short, I chose Ruby. I still program in Python on the side. I'm hoping to soon release a Python version of KirbyBase that is equivalent to the Ruby version. But, without those blocks, it's just not as much fun (although list comprehensions are cool!). Hope this helps answer your question.
Jamey Cribbs