Python is far more mature, isn't a strange ad-hoc combination of other languages, has a third-party library to do anything and everything (which is probably also reasonably mature), and doesn't have a community rife with arrogant children. 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 imagi…
... a community rife with arrogant children It's difficult to accept your rational argument when you include stuff like this.
Ask HN: Why Python over Ruby?
51–60 of 198 posts
Re: Ask HN: Why Python over Ruby?
#52For me it's very simple ! 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.
This is a cultural issue. In the Ruby (or Perl) community, if you use obscure language features to do a common task in a single line of code, you will be worshipped as a god. In the Python (or Tcl) community, you will be viewed with suspicion. Not that Python doesn't have one-liners (e.g. comprehensions) - just that everyone agrees which ones and when and how to use them.
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.
Re: Ask HN: Why Python over Ruby?
#53Earlier quoted context omitted.
... a community rife with arrogant children It's difficult to accept your rational argument when you include stuff like this.
Check out the Ruby blog scene. It's a wonder they actually write any code in between the bragging about how awesome they are and slagging each other off.
Re: Ask HN: Why Python over Ruby?
#54Why language X is better of Y makes no sense. Every language has its benefits and downsides. Python has been slighly longer around and has a bigger user community which resulted in more available library code. Ruby and Python is pretty much interchangable in the sense of features as they often steal from each other and vice versa. Ruby - follows TIMTOWTDI - Mutable strings etc. - has a greater emphasis on code genera…
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).
Re: Ask HN: Why Python over Ruby?
#55Ruby 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?
Re: Ask HN: Why Python over Ruby?
#56Earlier quoted context omitted.
...strange ad-hoc combination of other languages. 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…
I have used both, Python more than Ruby. 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 Ru…
Personally I find blocks far more intuitive than Python's iterators and generators, but that is a subjective thing.
WRT Magical Classes, I'm not a fan of everything being stored in a dict. It seems grossly under-engineered to expose the underbelly as a basic "dumb" object; at the very least, it should've been a "Class Metadata" object with attached support methods to make it easier (safer?) to inspect or update.
And lastly: there is NEVER just one way to do it!! Witness the confusion n00b's feel over the join() method: ",".join([LIST]) where the more intuitive would probably be [LIST].join(",")... but if you MUST have join() in the string module, why not support the latter as a redirect to the former?
Seriously: this sort of dogma can make certain kinds of algorithms very messy to code.
However, my biggest beef with Python is that I seem to have to write a metric buttload of boilerplate and end up with something very Java-esque...
Re: Ask HN: Why Python over Ruby?
#57* 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.
Re: Ask HN: Why Python over Ruby?
#58Earlier quoted context omitted.
Check out the Ruby blog scene. It's a wonder they actually write any code in between the bragging about how awesome they are and slagging each other off.
So you're going to judge the entire Ruby community by like... 5% of their bloggers? :P
Ruby developers (Rubyons?) were renowned for typical Japanese self-effacement when it was becoming popular, which I think was some of the appeal... I guess what goes around comes around...
Re: Ask HN: Why Python over Ruby?
#59None 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.
Re: Ask HN: Why Python over Ruby?
#60Ruby has clever syntax. Python has pure syntax. 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 g…
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?