I don't want a flame war or religious arguments. I would like to understand what made Python win in this space. Thanks so much for commenting!
I'm generalizing to some extent, of course, but these are the things that I and other developers I know associate with Ruby (including many who's startups are built on it). I imagine as the language and community grow and mature they will shed these associations and hopefully create a language worth taking seriously. They haven't done that yet (strictly in my opinion).
I call bullshit, sir. Ruby is objectively less strange and more consistent than Python. Some has to do with the fact that Python is older - hence has more baggage to carry. A lot of it, though, just has to do with poor/missing design choices. Specifics?
- ruby 'block' passing convention is much cleaner and more powerful than python's 'for'/iterators.
- python's global functions are stranger and more ad-hoc than Ruby's strict object-orientation.
- ruby's mixins > python's multiple inheritance
- python underscore (and double underscore) naming conventions to overcome simple language features
Don't get me wrong: i love python - but primarily because of the faster execution and larger community - not because of the language itself.
Python's iterators are more usable in many situations than the Ruby block system. I can return an iterator, stick it in a variable, call another function with it that returns another iterator, and so on.
Python's classes also seem cleaner and less magical than Ruby's. For example, a method on a class is just an attribute that happens to be a method. Much more intuitive than Ruby in my opinion.
I'm also fond of Python's idea that "There should be one-- and preferably only one --obvious way to do it".
I agree that Python does have its fair share of strangeness, but that fades away with time (you don't notice it).
Having ploughed through several tutorials, I did not find Ruby particularly "elegant", or its syntax particularly obvious. Much of it seemed ad hoc, thrown together, in particular when there were several different ways of doing something, and it seemed to be the philosophy of the language to provide all of them. I did not find its constructs as intuitive and natural as claimed, trying out simple coding examples proved as frustrating when things didn’t do what you’d suppose they’d do...
(http://www.bitwisemag.com/2/What-s-Wrong-With-Ruby)
I actually gave Ruby a shot, going through the interactive tutorial on http://tryruby.hobix.com. I couldn't do it very long, however, because it was completely ridiculous. In what world does it make sense for hash keys to double as string grep? For instance:
my_string['foo'] = 'bar'
will replace the first instance of foo in my_string with bar?! WHY?! I can stick an exclamation point on the end of method calls... to signify mutation? WHY?! What twisted logic allows one to rationalize multiplying strings like: "5" * 2 == "55"
yet throw an exception for: 2 * "5"
It makes absolutely no sense! And why would an integer have a method for converting itself to a string? Or an array? I found so many things in Ruby that made me think, "Okay, superficially that's really convenient and sorta cool... but it makes no sense and it is absolutely counter-intuitive. And I feel dirty using it, even if everybody is doing it." Some people, I assume, find Ruby to be "elegant" for the same reasons I find it to be "an abomination."During FISL, a couple days ago, I witnessed something that really bothered me. It was a presentation comparing Rails with Seaside (which is, by itself, like comparing racing cars with subarines) and the arrogance of the Rails guy dismissing Seaside, Squeak and Smalltalk was very uncomfortable.
It seemed the room was too small to fit all the egos inside it.
I considered staying until the end and asking a couple questions to demolish the presenter, but I decided it would not be worth it. His belief on the inherent superiority of Ruby and Rails over any other language and framework, past, present and future, bordered on the religious.
If Rails weren't around, it would be much easier to enjoy Ruby without having to use it in isolation. Then again, a whole lot of people wouldn't have gotten into it in the first place.
Ruby lived fast and died young. If you don't want to use Python, learn Haskell.
It's difficult to accept your rational argument when you include stuff like this.
And while it certainly isn't a fault of the language, it definitely influences it usage for some people.
And yes, a lot of us pythonistas view him with suspicion.
How so? It's mot like Python is 10 or 20 years older, so how do you determine the "far more" part?
And of what value would this difference in maturity be? COBOL is "far more" mature than Python. Is that a big win for COBOL?
Once a language reaches some reasonable age and general wide-spread usage, points about maturity seem silly.
(On reflection, I suspect you're just trolling.)
On the flip side, I am not aware of any significant impact of Ruby in commercial development that is not web-driven. When we bid on projects and talk to prospective customers, we're typically making a case against Java and C++. I can't recall a single instance where someone seriously asked us about Ruby. (We've had more inquiries about KDB and K, that abomination of a language.)
So, just my $.02 as a scientific software developer.
For instance?
Ruby has method aliases. Python does not allow a string to capitalize itself.
Ruby uses Ruby methods within Ruby classes to extend Ruby. Python has decorators so you can write functions that return functions that return functions to create a new function.
Ruby has strict object-oriented encapsulation. Python is laid-back about objects, because you probably know what's going on inside them anyway.
Ruby lets you leave off parentheses so you don't miss objects having attributes too much. Python will let you mix tabs and spaces for indentation, but passive-aggressively mess up your scoping as punishment.
Ruby has seven kinds of closures. Python has one, in the unlikely case a list comprehension won't do.
Ruby's C implementation is a mess of support for language-level flexibility. Python's C implementation is so clean you get the unsettling thought that you could probably write Python using C macros.
Ruby supports metaprogramming for cases when programmers find it more descriptive. Python supports metaprogramming for cases when programmers find it necessary.
Ruby is expressive. Python is direct.
Ruby is English. Python is Esperanto.
Ruby is verse. Python is prose.
Ruby is beautiful. Python is useful.
I like Python, but coming to it after using Ruby for seven years, well, I think it's like dog people and cat people. You can like having one species around, but you're always thinking -- why they can't be more like the other?
>>> "hello".capitalize()
"Hello"
Python has decorators so you can write functions that return functions that return functions to create a new function.Or functions that return classes, or classes that use other objects, or any possible other use for the pattern "wrap this with that and save the result"
Python will let you mix tabs and spaces for indentation, but passive-aggressively mess up your scoping as punishment.
$ ./mixed.py
File "mixed.py", line 3
print "b"
^
TabError: inconsistent use of tabs and spaces in indentationAnd as for indentation, I think Guido should have followed through with making tabs a syntax error, because they are part of the syntax and are fiendish sources of error. Let's just say you have this code, properly indented with spaces:
class X:
def visible(self):
pass
And you open it in a non-Python-aware editor, say for Windows, which has a four-space tab length and does not convert them to spaces. You add: def invisible(self):
pass
at the end of the file using your tab key. Now you have a potentially crazy-hard-to-figure-out bug.Python is like being in the Netherlands. You're surprised that everything seems to work so well but at the same time something feels a bit weird.
Also, i would point out that sometimes, expressiveness is useful :P
So sorry sir, but this isn't just biased, but also bordering on a troll. Bullet points like these are not justifications in themselves. They're just a list of things to try and DDoS an argument.
What is your actual point?
"So sorry sir, but this isn't just biased, but also bordering on a troll."
Poster is being facetious (somewhat :) ) to make a point about differences in language and community philosophies.
The semi-troll nature is pretty amusing, though. The "verse/prose" comparison is sure-fire flame-bait; I love it. I will keep that one handy ...
just try to compile it on OpenSolaris with Sun compiler.
hint: Perl or Ruby were passed 100% tests.
Python became popular with Linux and open source developers before Ruby did, and has had slightly more time to develop a nice set of libraries to do just about anything.
The online Python documentation tends to be pretty good. When I picked up Ruby a year and a half ago, and I tried to find the documentation, people generally pointed to the pickaxe book as the de facto documentation.
Although I've been using Ruby on windows the last few weeks with Ruby Shoes from _why(normally use for unix scripts or web-dev). It's pretty nice (although a little rough around the edges as it's under heavy developement).
When you install shoes (the latest version anyway) you get the GUI tools, ruby gems, and sqlite, and a ruby interpreter, all neatly packaged. And there is a whole load of items I havent looked at yet. It's fun.
Come to think of it, we, ruby programmers, don't really pay our dues. 1.9.1 has been out since January/February, and nobody bothered to package it for OSX, Windows, or Ubuntu.
Thanks for bringing this issue into the light.
Nowadays I work on Kubuntu, and maybe things have changed, but I've no bad experiences with Ruby on Windows.
None of these are reasons why people choose Python over Ruby. Or why Python has become more popular. It is worth noting that Python was also mentioned a lot as a teaching tool when its popularity began ramping up, and some universities have replaced Java and Scheme with Python as an introductory language.
Python really is not appreciably better than Ruby, in my experience. Nor will i claim that Ruby is appreciably better than Python. I personally use Ruby in daily life, and used to use Python prior to discovering Ruby. Both languages support some really weird warts, inconsistencies, and baggage that they retain for the sake of backwards compatibility.
Instead they really do provide different philosophies on life. To claim that Ruby is a tangled soup of options and syntactic sugar is to miss the point really. Nor is Ruby is not trying to be all things to all people. Matz cares about one thing, and that's the ability to let programmers get work done with as few cognitive hurdles sourced from the programming language itself. Does that mean you have options? Yes. Does that mean that it would be better to only have one way to do everything? Not necessarily.
What is the point? I sincerely wish to learn, for my own intellectual curiosity. Because I have read Ruby code and I have done Ruby tutorials and talked to people who use Ruby and for the life of me, no matter how hard I meditate on the issue, I cannot understand why anyone would use Ruby over Python.
I don't feel Python is absolutely better than Ruby, anymore than an apple can be absolutely better than an orange, but I have yet to gain a comprehension of how Ruby is even relatively better. From a Python -> Ruby perspective I find it particularly perplexing.
Ruby presented far more cognitive hurdles for me because it allows you to do things in ways that seem simultaneously mildly more convenient and completely counter-intuitive to everything I've experienced with similar styles of languages over the past 10 years.
However, from a language point of view, I have a slight preference towards Ruby. Here are some things I like: 1) More consistent commitment to object paradigm, e.g. all function calls are actually method calls on an object. In Python, everything is an object, but sometimes you use methods, and sometimes you don't, e.g. list.pop() vs. len(list). 2) I think blocks are very handy. 3) I like the more Perlish regex syntax. 4) There is a cleverness to Ruby that might not be the best thing for a corporate environment, but it makes it fun.
So, if I was writing code just for myself, I might choose Ruby over Python, assuming performance and library support were sufficient.
Don't use Ruby.
If it presents that much trouble, go find another language. Use Python or C# or Haskell or whatever fits best and gets the job done.
Many of the things you find to be cognitive hurdles and completely counter-intuitive are there on purpose. They are never going away because many other people (and matz in particular) find them to be cognitive enhancements and completely intuitive.
Don't waste time fighting it.
I occasionally tangle with a friend who is a Ruby fan, and who tried Python back in the 1.4 or 1.5 days and gave up on it. He still hasn't delivered me any solid reasons for trying out Ruby.
It is entirely possible that neither language presents sufficient relatively advantage compared to the other to persuade an expert in either to switch. The only exception would be due to a 3rd party application or library that is only available in one of the languages. (For instance, I work heavily with numpy and scipy; I'm not aware of Ruby equivalents.)
The compiler/interpreter should work for me, not force me to work for the compiler/interpreter. (And no, there's not always preferably one way to do things, which is an attitude I can't stand.)
I can READ other people's Python code with greater ease than Ruby, Java, C#, C++ or even C. At the end of the day, the quicker I can assimilate library code the quicker I can use it well and the quicker the module gets completed and fully tested. Of course, with Google and Eric Raymond raving about it, the confidence factor increased further.
It is true that Ruby gives you a lot of rope. People with good design sense appreciate that your code should not be too clever.
Just which Ruby community is this? None that I associate with, that's for sure.
To the people who voted the OP up; is it because of your own first-hand experience with other Rubyists? For all I know there are clusters of Ruby coders who encourage obscurantism, but I've not encountered them (though I've been part of debates over just what constitutes "obscure").
<pre> Weighted use of Search Term Hits Search Term Hits obfuscation
"obfuscated perl" 1390 "perl programming" 164000 0.85% "obfuscated python" 234 "python programming" 157000 0.15% "obfuscated ruby" 269 "ruby programming" 133000 0.20% </pre>
If I use the word golf, I get: <pre> Weighted use of Search Term Hits Search Term Hits golf
"perl golf" 1780 "perl programming" 164000 1.09% "python golf" 171 "python programming" 157000 0.11% "ruby golf" 547 "ruby programming" 133000 0.41% </pre>
This is of ccourse, the same statistics that fueled the last financial meltdown :-)
I get the impression that there are more 3rd-party libraries in Ruby, so it is easier to get web code up and running with ruby.
For instance, Haml and Saas are pretty widely accepted by Ruby web developers, whereas Django templates are very popular with Python web developers precisely because because they are close to straight HTML. Ruby developers (like Ruby itself) readily adopt good ideas from other languages, including Python (rack from wsgi, rip from pip, merb slices and rails engines from django apps), while anything that resembles anything from ruby or rails, like some Pylons components, gets criticized by many python developers. It's noticeable with version control, too, as svn is still very widely used by Python developers whereas Ruby and Ruby/Py developers moved completely to git and hg over a year ago.
Django is the most popular single framework, but at least as many people prefer to roll their own based on various modules. Some of the most popular backbone kits would be werkzeug, cherrypy, webpy, pylons. Then there's literally dozens of template languages (jinja, genshi, cheetah, to name a few) and at least three mature ORMs (sqlalchemy, storm, sqlobject) to choose from.
So, while I have no idea about ruby libraries I can assure you that in python-land you get to choose between at least two mature options for pretty much any web-related task.
Both impls appear to work well enough on a wide range of platforms, the sun compiler is not exactly what makes or breaks it.
btw, Solaris will stay on its niche like FreeBSD.
After that, your problem disappears.
I wouldn't say Ruby has lost just yet.
Regarding libraries; you are right. Ruby has a lot of code out there, but much of it is in random repositories maintained by random people. Hopefully this changes.
JRuby FTW.
Yes, there are downsides to sitting on the JVM, but for anything other than one-off scripts, or where start-up speed is really important, JRuby gives the best of both worlds[0]: Ruby syntax with JVM libraries.
[0] Clearly if you do not care for Ruby syntax then this is not a win. I believe, though, that JRuby is more advanced and stable than Jython. But the Jython folks are quite capable for continuing to kick ass, so that will improve.
Ruby
- follows TIMTOWTDI
- Mutable strings etc.
- has a greater emphasis on code generation ("meta")
- VM's are much slower than Python (there is no Psycho etc.)
- emphasizes code clearity and readabiliy (human cycles are more important)
- Libraries are much less mature
- ...
The lists of differences could go on forever. A comparsion and "why" is difficult. I think they are too similar and the people are too polarized.
A language is a tool to solve a particular problem. In the case of Python you have higher momentum of the community and the switch from C/C++/Java to Python is often easier than to Ruby. (Wild statement of me with tests from a sample set of 2 test subjects ;) )
Probably the best characterization I can come up with is. Python is already on this "Enterprise" trip where companies use it a lot and so forth. Ruby has some interesting companies pushing it (Twitter etc.) but is not compeletely there yet, it still has more "hacker" and "monkeypatch" feeling. Oh wait, we call that "ninjapatching" in Ruby ;)
Python is not a radically better choice in terms of speed (and hell that's true even w/ 1.8. Sure Python's faster, but we're not talking orders of magnitude here).
"Python has been an important part of Google since the beginning, and remains so as the system grows and evolves. Today dozens of Google engineers use Python, and we're looking for more people with skills in this language."
When I first saw this, I went "Google? Whoa. I gotta check this out" :)
http://en.wikipedia.org/wiki/Cargo_cult_programming http://weblog.jamisbuck.org/2008/1/7/never-ever-cargo-cult
I had a similar experience in '02 or '03. Then I quickly recognized that Google's decision to concentrate on Python, Java and C++ doesn't have any bearing on my companies' choices, especially since some major factors in Google's decisions (eg, dealing with a very large number of internal developers) just don't apply.
That's one cool list
Having found Python, I really don't feel a pressing need to learn another scripting language. Instead I'm working on Objective C.
Ruby borrows some stuff from Smalltalk. You know what other language borrows heavily from Smalltalk? Objective-C :)
I'd love to learn Scala (after being a Haskell and Ruby fan for years) but finding the time is incredibly difficult...
But more seriously Python is a growth like Javascript. It has grown and adapted to every change it has been required because it has a very rapid iteration time and is great for wrappers to core C. It is clean and maintainable.
For this it has made huge inroads to system administration, game development, tool plugins, web development, command tasks and everything else. I have yet to have one instance where there weren't numerous libraries for every task. Even if you don't want to use a third party library there are many examples of how to do it.
Python is really at it's core many things. It is a functional language, it is an OO language and it can be procedural. It can wrap intense lower level libraries or port in a C extension for speed. The same code you wrote for your desktop api, can be used in a desktop app, a service, website, a web service, a tool plugin, at the command line or any way you need it.
It can float like a butterfly and sting like a bee.
Like Javascript, Python is based on a core few types, lists and dictionaries (objects). All the languages that seem to permeate like viruses have this basic computer science fundamental. It just is as simple and clean as you can get. Ruby also has this but it came a bit later.
And finally, it is named after the great Monty Python.
end
Nearly all of the installers and packaging formats and management tools in Linux have Python APIs.
Edited as I wasn't clear the first time round: I love Python's wide variety string methods, and the emphasis people put on these rather than using RegExs all the time (sorry, I have more Perl and less of a Ruby background). Looking further it seems there's Ruby equivalents of most of my frequently used methods.
I love etrees in the standard library. People who use regexs for dealing with tree structured data are mental. Again, perhaps a Roby fan might enlighten me if there's a similar data structure in Ruby, I wouldn't be surprised.
What do you mean? Of course Ruby has a String class and plenty of methods on it, but I'm not sure if that's what you're talking about.
Ruby comes with an XML library standard, sure, but it's pretty bad. In my experience most people use competing libraries, of which there are several high quality options. You can get a walkable tree from the core library but you'd be better off with one of the superior third-party libraries like hpricot or nokogiri.
(edited badly written original)
The behavior I'm referring to is loading XML into a tree shaped data structure, so you can reference particular branches when seeking or adding content, and not have to think about about tags (well, once you'veran it though BeautifulSoup or a similar cleaner).
It is a stinking pile of shit.
For example, this from Wikipedia:
(3..6).each {|num| puts num }
Has some funny brackets and pipes. In Python, it's much more familiar to C-ish folks like me: for i in range(3, 7):
print iPython has NumPy/SciPy/and friends, so I use Python.
This, I feel, is a strong point for most who are using a scripting language to do scientific work.
Also what kind of work are you doing?
I use them for bioinformatics analysis (large scale genomic comparisons and microarray data analysis). So the larger problem isn't the calculations, it's the data management. And for that Python wins over a pure R solution.
And strong company backing: Google has have hired some of the core Python developers, and some of its infrastructure is written in it... Flumotion with its streaming media (although codec stuff is mostly gstreamer, but most of the networking stuff is in Python)
And the final straw - Python just seems to be a bit more beginner friendly...
The main reason was when they were standardising on the core-languages they could support, Python was enormously far ahead cf. the competition, so it was an obvious choice. And now, with all that code investment, you do NOT want to start again. And if you have the money, of course you'd be interested in hiring the best developers for your code-base.
Likewise, I believe Python 3000 is unlikely to used in Google for the forseeable future, due to that same code investment. I don't think Python 2.6 is fully supported, either...
I don't think "a bit more beginner friendly" is truly accurate. Most beginners will look for doc's and books, and for a good few years, recently, there was a dearth of good Python books while there seemed to be a new Ruby or Rails book every month, including several allowing you to d/l them for free.
I have to admit that I used to recommend Python to beginners for a long time, as it helped them avoid developing bad habits with the other equally popular "beginner" PHP and Visual Basic languages. These days, it's a toss-up.
If the person talks about writing web-apps, I'll tend to recommend Ruby and Rails as it has earlier ROI for a beginner, therefore a lot initially more satisfying.
After their pretentiousness, their arrogance, and their vociferous obnoxiousness, I find their misuse of this once-widely understood term to be their most annoying attribute. It seems like not a day goes by without some eager Ruby programmer hacking together yet another block-based API that kind of, sort of looks like Smalltalk if you squint enough, uploading it to GitHub or some similar site, and then slapping the "DSL" label on it, because Ruby, apparently, is just too cool and powerful a language to have mere "libraries" or "APIs."
Ruby does in fact both have libraries and APIs (hyperbole aside). But none of what you've described is a reason why Python has become more prevalent than Ruby. This is just your personal bone to pick over nomenclature used by the Ruby community.
Rails is not the only piece of software in the Ruby community, and definitely not the most well designed (although it too is being improved significantly both in consistency and cleanliness in the push to 3.0).
Granted most things people call DSLs frankly are not, an internal DSL is a well known concept and repeatedly implemented in a lot of languages.
Although it's worth noting that Ruby too, runs on GAE using JVM based implementation (JRuby).
They're both good languages with good communities though. Each has a few advantages and disadvantages, but they're similar enough that if you know one you should probably stick with it and be happy, and pick something farther from the tree as your next language (Erlang or Scala, say).
Reality seems a bit different to me:
http://www.tiobe.com/index.php/content/paperinfo/tpci/index....
http://bitworking.org/news/413/ruby-books-sales-a-retrospect...
It's also, to me personally, a lot faster to whip something up in Python than in Ruby, even when I knew them at about the same level.
Matz's decision-making process
He tries to make Ruby be all things to all people
Lots of confusing sugar and overloading baked in
I much prefer Guido's hard pragmatism
The pointless panoply of function types: Methods, Blocks, Procs, Lambdas
All intertwined and yielding into one another.
I love that in Python there is only one:
Objects with a __call__ method, defined metacircularly.
The culture of adding/overloading methods on base classes
Many gems do this en masse, and there are a lot of low-quality gems
Seriously, Ruby might have a ton of new gems for everything, but they
are almost universally awful. A culture of sharing any code that *could*
be a module, no matter how trivial, leads to immature crap being widely
used because it was there already, with a mess of forks to clean up
afterwards. At least most of them are test-infected...
Python does come with a few stinkers, mostly ancient syscall wrappers.
Especially disastrous because it's unscoped, and infects the whole process
For a language with four scoping sigils it sure fucks up scope a lot
The syntax practically begs you to do it, anything else would look shitty
The Matz Ruby Implementation
The opposite of turtles-all-the-way-down (Smalltalk crushed beneath Perl)
It actively punishes you for taking advantage of Ruby's strengths
The standard library is written almost entirely in C
It doesn't use Ruby message dispatch to call other C code.
That means that if you overload a built-in, other built-ins won't use it
Anything fiddly that's not written in C will be dog slowI hate Python's neglect (by Zed Shaw): http://www.zedshaw.com/blog/2009-05-29.html
Ruby seems to be so much more "symmetric", Python feels like a hack on top of dictionary to me.
Ermm, datetime.strptime and datetime.strftime?
For example, Ruby has backward incompatibility issues in minor releases that would never be permitted in Python. They had to jump to Python 3 for even fairly small things that wouldn't be accepted in the 2.x line. Even subtle incompatibilities between Python versions are taken seriously, and there's a documented process for deprecation that involves multiple releases and means when a feature is deprecated it'll probably still be available for years. There's cruft in the language as a result, but for people using Python seriously this is more than worth it.
I think the Python-Dev community is also more mature. Changes get serious review. Though there's not a formal "core", strong objections from certain people are enough to bring a new feature back to zero and require a restart (not because those people have special weight, but because they are respected and everyone kind of understands there's a benefit to listening to crotchedy naysayers if they are smart crotchedy naysayers).
The community is large enough that there's a lot of domain knowledge. Python is better at getting a canonical and complete solution to a domain problem than Ruby. WSGI discussions for instance involved some people with a very intimate knowledge of HTTP. People work hard to get 95% solutions instead of 80% solutions. In part because Python has been around a long time, and there's already at least an 80% solution for whatever problem you are looking at, and if you are going to throw your hat in the ring you ought to be ready to try harder. I think the more aesthetic tendencies of the Ruby community work against it here, as people are more likely to rewrite for aesthetic rather than functional reasons. (OTOH, when Python settled early on some 80% solutions, it's caused a lot of difficulties because it's been hard to overcome inertia to introduce a better solution, while it's hard to get really good adoption of the 80% solution; pydoc would be an example.)
Then there's simple maturity. The VM is more stable; it may not be a great VM, but it is predictable. There's lots of tools for writing extensions. There's code for dealing with large data sets, for dealing with images, for accessing system libraries, etc. For any one problem Ruby might work fine, but for the problems you don't yet know you'll have to solve it's less likely you'll hit a blocker with Python.
Why limit the discussion to Python and Ruby? Why not include PHP, say? Why have Python and Ruby "lost" to PHP? What about C++, Java and C#?
Heck, VB is still more "popular" than either: http://www.tiobe.com/index.php/content/paperinfo/tpci/index....
I compared to Ruby, because that's the language I would choose for scripting, based on the ability to create nice internal DSLs.
Interesting. I was a Perl hacker, and Ruby was the obvious choice for me.
* Namespaces - Ruby has namespaces but when you are reading some code it is very hard to figure out what got mixed into what. This may be more predominant in the Rails world than others. You can exactly know where each one of the classes and methods came from unless you are doing a 'from x import '
Clean code - I know that with most editors today, you can have clean code. But python's insistence on indentation makes the code appear clean and very readable. This was an excellent design decision.* Method and class invocations need () - This view is very subjective. While ruby's method invocation style gives rise to a lot of DSLs, python's style of invocation means that there are no silly Proc objects. If you need to pass a function to another function just send its name. I am not saying that one way is better than the other but I like python's explicitness here.
* OpenStruct by default - This is one of the best design decisions ever. Python uses a very fast implementation of dict for its objects. That means you almost get a javascript kind of object without the clunkiness of javascript.
I am biased a little bit towards python as I learnt python first. I do love Ruby's DSLs but I have a heart for Clojure too, in this regard. And I am actually quite happy that Jython 2.5 has come out. I am a little disappointed that Jim jumped over to the IronPython and left Jython hanging. But thanks to him, Python is there on all the major platforms.
I've heard Python developer's working on a Ruby on Rails application that the problem with Ruby is that approximately equivalent to Python in terms of productivity. They wanted to use Python, but pragmatically you can't make the case to management to switch from one language to the other if the other language is more or less the same. But most of the time this effect works the other way around, where Python was established before Ruby.
I was doing Perl in 1999, and looked at switching to Ruby or Python. Python was still quite small back then, but you had web frameworks (Zope, Twisted), albeit the incarnations back then are clunky by today's standards, but Python was establishing itself as a clean, readable, dynamic language. Ruby on the other hand had no web frameworks, and almost no documentation in English - the only reason I was considering it was because I was working with a Japanese localization team and they thought Ruby was quite hot.
The debate over which dynamic or scripting language to use was always between Perl and Python back then. Perl was the incumbent and Python the challenger, Ruby rarely factored into the picture. It wasn't until Rails started to become useable and gain attention in 2004 and 2005 that Ruby interest started to really blossom. And so Python was well established for many uses: scientific computing, ad-hoc data processing, network programming. If you're a development manager of an application that you want to make scriptable, you would have made the decision to already go with Python, there just isn't any compelling reason to switch to Ruby beyond the sake of switching.
Another example is IronPython versus IronRuby: work started on IronPython in 2003, work started on IronRuby in 2007. IronPython is at version 2.0, while IronRuby is at version 0.5, and this is reflected in the polish of these language implementations. A .Net developer might decide that they prefer the idiosyncracies of Ruby over Python's idiosyncracies, but if they had to start a large project in today, they'd most likely choose IronPython since there is much less risk of the project bumping up against the rough edges of IronPython versus IronRuby.
At my job I use Python because, well, at some point before I arrived one of the senior developers went on a jihad against Perl. :-)
I've read stuff about Ruby and while some things about the language intrigue me, it seems that any application you can build with Ruby can also be built with Python. If I'm going to learn another programming language in my Copious Free Time, I want to learn something really different from what I already know, not something that has pretty much the same features with different syntax and libraries. So Python wins by inertia.
I submit that Python is more popular in this space because:
- many end users will be users of the package first, and programmers very much second. In this case a very gentle learning curve is more important than ultimate expressivity for hackers.
- In the same vein, it superficially looks more like BASIC than Ruby does
- The C API may be simpler to use than the Ruby interpreter, though never having used Ruby's C API that's speculation on my part. Never understimate implementor laziness as a technical driver.
You might choose Python for exactly the same reason; e.g., I wouldn't use Ruby on teams with >2 developers, especially in Google. Python is more straightforward but at a (small) price of freedom.
Example: you can rapidly prototype in Ruby using blocks and extend basic classes (even integer) using monkeypatching. I was fascinated by this, yet I wouldn't monkeypatch when working with other people so that advantage goes out of the window.
When NOT talking about embedding or scripting, I'll probably take ruby.