5 ms·
What's clear to me reading the comments in this thread, is that there are a lot of people who like Python, and don't understand what people appreciate in Ruby.
by knowtheory 17y ago
What's clear to me reading the comments in this thread, is that there are a lot of people who like Python, and don't understand what people appreciate in Ruby.
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.
- tdavis 17y agoTo claim that Ruby is a tangled soup of options and syntactic sugar is to miss the point really. 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.
- greggraham 17y agoI currently use Python and Django for the following reasons: 1) Coworker familiar with Python 2) I had an easier time understanding the mechanics of Django than I did Rails 3) Some libraries I needed were only in Python 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.
- seanodonnell 17y agolen(list) is actually a shortcut for calling list.__len__() , any object that implements the __len__ method is therefore compatible with it. So in practice, len is in fact a method call. Almost every python function that operates on objects is just a similar shorthand.
- ubernostrum 17y agoHumor me for a moment, because I've been asking this question of many people for a long time and have never yet gotten a straight answer. Why is len() always the thing people pick on? Why is it always "Python uses len(obj) instead of obj.len()", and never "Python uses str(obj) instead of obj.str()", or any of the various polymorphic built-ins like sum()? I've seen this so many times now that I'm honestly quite curious about it. Also: "More consistent commitment to object paradigm, e.g. all function calls are actually method calls on an object." Every function call in Python is always an invocation of a method on an object, even if it doesn't look like it. len(), of course, delegates to a method on the object. But even standalone functions are method calls. Try this: >>> def add(x, y): ... return x + y ... >>> add(3, 5) 8 >>> import types >>> types.FunctionType.__call__(add, 3, 5) 8 The last couple lines there are what's really going on when you call the function. (also, just as Ruby's "built-in" functions are really methods on Kernel which is made available globally, Python's "built-in" functions really exist in a module that's made available globally (and __builtins__ is its name)