6 ms·
Anyone have any thoughts on why python and ruby are so similar, yet so far apart? They are obviously very close, because people switch between them all the time
by AlexanderDhoore 14y ago
Anyone have any thoughts on why python and ruby are so similar, yet so far apart? They are obviously very close, because people switch between them all the time. And they are compared on everything (languages features, libraries, tooling...). I think it's a healthy competitive environment.
- Goranek 14y agoI'm a huge Python fan and there is nothing in the world that would force me to switch to Ruby =P
- AlexanderDhoore 14y agoThat's exactly what I mean. People feel very strongly for one or the other. Yet, even you, can't deny that they are very similar! Compare them to Java, Lisp, C, Go, Haskell, Perl,...
- __david__ 14y agoActually, I'd lump Perl in with Python, Ruby, and Javascript. They're all at about the same "power level" and have more or less the same built-in types and language features. They all have their own personality but if you only know 1 of the 4 you're still perfectly capable of writing any program that will be more or less equivalent to someone writing the same thing in one of the other 3.
- erikpukinskis 14y agoThis thread is full of people saying "I use (python|ruby) and (ruby|python) seems fine. There's just no reason to learn it" and you respond excitedly to this comment as if it's representative. http://en.wikipedia.org/wiki/Confirmation_bias http://en.wikipedia.org/wiki/Confirmation_bias
- deleted 14y ago[deleted]
- AlexanderDhoore 14y agoThe above comment happened to be one of the first responses. The others came later. That's why.
- gruseom 14y agoPeople feel very strongly for one or the other. Yet [you] can't deny that they are very similar It's their very similarity that gives rise to the strong feeling. René Girard's theory of mimetic rivalry sheds light on this. Edit: Alternatively, http://en.wikipedia.org/wiki/Narcissism_of_small_differences http://en.wikipedia.org/wiki/Narcissism_of_small_differences
- stiff 14y agoI was thinking about this lately a lot as I started doing some Python after almost 10 years of Ruby, I think it boils down to the simplicty vs. elegance tradeoff. If you want to have elegant, very high-level APIs that hide a lot of details, like Rails with has_many :posts in class definitions etc. you have to sacrifice simplicity and transparency - this is what defines Ruby in comparison to Python, in hundreds of places Ruby chooses to be elegant sacrificing simplicity when Python does the opposite. As a result Ruby code is often a bit shorter and reads a bit more easily but Python runs faster and makes it easier to understand the code in its full detail, since there is much less "cleverness" going on behind the scenes.
- deleted 14y ago[deleted]
- donw 14y agoThe unfortunate thing is that there really isn't a tradeoff if you build your elegant and simple DSL on top of a set of API primitives that give you access to low-level behavior. Look at Hibernate. As of the last time I used it (admittedly, several years ago), it was almost impossible to run raw queries against the underlaying database and get back simple result sets as arrays of tuples. You had either the abstraction, or nothing. With ActiveRecord, you can at least get at the underlaying database connection via select_all and select_values, and turn Relations into SQL queries via '#to_sql'. It's not perfect by any stretch, and for some reason I don't understand Arel decided that being able to OR two queries together wasn't important, but you can leave the abstraction when you need to. (Mongoid, the MongoDB ORM, is actually really well-designed in this regard; the Mongoid::Criteria works like Arel should, as does Sequel...)
- jbverschoor 14y agoSorry, but Hibernate has been far superior to ActiveRecord from day one. ActiveRelation is very similar to the criteria api, but it still uses string parsign. HQL is awesome. That said, I haven't done Java for 3 years and am a 100% rubyist (and some lua) The developments of rails are good. But they are simply all the stuff that maturing platforms will need. Rails is becoming JEE, but in a more developer friendly way. This is a good thing.
- reinhardt 14y agoWhat do you mean by "so far apart"?
- AlexanderDhoore 14y agoI think they are very different too... I just can't explain how or where. Some people SWEAR by one of the two, and refuse to use the other. That's pretty harsh for languages that similar. There must be a reason... (The simplicity vs elegance argument makes sense) Edit: I think I mean the communities are far apart.
- Joeboy 14y agohttps://en.wikipedia.org/wiki/Narcissism_of_small_differences https://en.wikipedia.org/wiki/Narcissism_of_small_difference...
- AlexanderDhoore 14y agoThat actually might be it. Very interesting. Thank you! (Makes me think of Scheme/Clisp too)
- venus 14y ago> Some people SWEAR by one of the two, and refuse to use the other Meh, I use Ruby for most of my work (day and side projects) but have nothing against Python. If I was writing a script for something on the OS I'd probably use Python. Some people just really want to feel part of a group, I guess, and publicly dissing "the other" makes them feel more included in that group, or something. As for me, I like to feel like part of a group too, but it's a more inclusive "programming" group, rather than focussing on any one particular toolchain.
- dasil003 14y agoI'm a rubyist. I have nothing against python at all, but I have zero interest in learning it. Why? Simply because if I'm going to devote mental capacity to a new language I want it to be more different. Haskell is my current choice because as far as I can tell it is the opposite of Ruby in every way except the one that is my primary criteria for interest in a language: concision.
- GHFigs 14y agoWhen two things are very similar, people tend to develop stronger feelings about the differences that remain. I once discussed the phenomenon that is precisely communities with adjoining territories, and related to each other in other ways as well, who are engaged in constant feuds and in ridiculing each other -- like the Spaniards and Portuguese, for instance, the North Germans and South Germans, the English and Scotch, and so on. I gave this phenomenon the name of "the narcissism of minor differences", a name which does not do much to explain it. We can now see that it is a convenient and relatively harmless satisfaction of the inclination to aggression, by means of which cohesion between the members of the community is made easier. -- Sigmund Freud, Civilization and its Discontents http://www.historyguide.org/europe/freud_discontents.html http://www.historyguide.org/europe/freud_discontents.html See also: http://en.wikipedia.org/wiki/Distinction_bias http://en.wikipedia.org/wiki/Distinction_bias
- deleted 14y ago[deleted]
- InclinedPlane 14y agoRuby is Perl as it always should have been. Python is a dynamic variant of a better Java.[1] These result in two very expressive and potent languages with many similarities and with a lot of the best ideas of modern programming languages included (pure functions, lambdas, list comprehensions, etc.) but with fundamentally different core "belief systems" and zeitgeists. Ruby is very, very much a "there's more than one way to do it" language, while Python utterly rejects that and adopts the "there should be one, and preferably only one, obvious way to do it" philosophy. [1]: Obviously this is a very slap-dash comparison which isn't meant to be taken 100% at face value and is merely meant as a way to help illuminate the ideological differences between Ruby and Python, it's not an invitation to start a flame war.
- rat87 14y agoIf you want a better java look at c#, its statically typed with minor type inference but it has some support for dynamic types(http://msdn.microsoft.com/en-us/library/dd264736.aspx http://msdn.microsoft.com/en-us/library/dd264736.aspx). Neither python nor ruby have any special support for pure functions, I suppose you could use some sort of decorator marking pure functions which one of those python subset compilers(or pypy) could use for performance optimization but I'm not aware of anything like this happening right now. Also I don't think ruby supports list comprehensions it supports oo styled higher order functions, c# without the special syntax does the same thing. You may argue this is just a syntax but list comprehensions are just syntax that , you can rewrite them with nested for loops and appends(yields in the case of generator expressions) I think in many although not all ways ruby is more of a smalltalk(but more practical). Python doesn't exactly have an exact idealogical parent, although it has ABC as a historical parent(http://en.wikipedia.org/wiki/ABC_%28programming_language%29 http://en.wikipedia.org/wiki/ABC_%28programming_language%29). Python outside of core imperative freeform do your own thing, want to write a oo based solution sure, want to write large imperative functions, go ahead, want to use modules to organize those go ahead. Want to use named function arguments or kwargs or objects or dictionary args go ahead. You can choose to use itertools, or your own yielding functions, or generator expressions sure.
- TylerE 14y agoI should point out that the first public version of Python was released almost 5 years before Java. So if anything Java is a poor Python, although I really don't like that comparison at all, as Python is not mandatory-OOP.
- PommeDeTerre 14y agoThe biggest difference is the communities surrounding each, and the impression each leaves on people. When I think of "Python", I think of a mature, helpful, experienced, talented, well-educated community. I can generally trust their advice, I can trust their code, and I can trust their technical decisions. It feels like collaboration is important and encouraged. The Ruby community, whether this is deserved or not, leaves a very different impression. Anything good is quickly and heavily overshadowed by the unnecessary and petty drama, the egos, the fixation on worshiping certain figures in the community (DHH, Zed, why the lucky stiff), poor technical decisions, inexperience, repeated displays of very immature conference behavior, and so forth. In can reflect very poorly upon a language when the community is generally toxic, like in the case of Ruby, or very positively when the community is generally superb, like in the case of Python. This is true even when the languages themselves are rather similar, from a technical perspective.
- patallan 14y agoI think this is a little unfair - you do prefix your thoughts on the Ruby community with 'whether this is deserved or not', but then treat your perception of the community as fact. I'm a Rubyist, and I've found that the vast majority of the community, events, interactions, etc are smart and civil. Yes, the Ruby community does have a bit of a publicity problem, but that's just the noisy/stupid minority. Perhaps this is a common issue more broadly. (Are all PHP developers stupid? Are all lawyers money-hungry scum? Do politicians have no regard for intelligent discourse?) Our media (whether that be mainstream or Twitter and HN) is great at highlighting the controversy, but not a good source for a deeper understanding of the lay of the land.
- deleted 14y ago[deleted]
- deleted 14y ago[deleted]
- atombender 14y agoAs a former Python dev, I find the Ruby community to be just as positive an experience as the Python. Different, but just as positive. Any community will have stratas of personality types that exist in various proportions: * The loudmouth alpha types (DHH, Zed) * The playful jesters (_why, Tom Preston-Warner) who are often evangelists * The sharp-minded, code-focusing engineer types code (lots!) * The newbies (lots, too!) The Ruby community has been perceived as blighted with in-fighting, but it is, in my opinion, rather a case of certain people, the first type, trying to be public leaders, and failing at it. Those big sounds are just ill-considered publicity stunts. It's clear that DHH wants to be the Linus Torvalds of the Ruby community, blasting his way through perceived idiocy with profanity-filled speeches appealing to common sense and good engineering. Zed seems to want to be Jamie Zawinsky. Leadership does not come from being loud. Ruby has its share of the playful and weird. Sometimes they give the impression of hyping something, because they bring with them their rosy-tinted version of the world where everything is fun and great. Sometimes they come across as glib and obnoxious because, well, they are, a bit. Overall I think they are an asset. These two types are the people you encounter if you follow blogs and tweets, precisely because those two personality types depend on publicity. The Ruby community will certainly seem overrepresented by idiots if you go that route. But if you go on the Ruby mailing list you will see a different community, one that looks more like the Python people. Matz and many other core devs are conservative, highly technical, mature, and very helpful. There are also many low-visibility sub-communities that are very professional. My local Ruby meetup community in Oslo [1] is a wonderful bunch of highly technical, development-focused people who have none of the negative traits you describe. And if you go back to the question of what a community is supposed to provide -- help, insight, direction, ideas -- there are tons of great people. That said, do I think the proportion of highly-skilled, high-technical is somewhat smaller in the Ruby community than the Python community? I do. Python has gained acceptance in more conservative, engineering/science/maths-oriented environments where Ruby has not yet reached, partly because of tools like SciPy. In fact, my feeling is that Python seems generally to attract a higher proportion of "engineer types" who are attracted by Python's rigidity (one way of doing things, etc.), compared to Ruby's often extreme malleability and laxness. This also means that the Ruby community is potentially missing out on some hard-core devs, and without support from the engineering/science/maths sphere it's never going to get things like SciPy. And as for the newbies, Ruby has perhaps a bigger than usual share of inexperienced devs who are pollute the library space with lower-quality code. I blame this on the fact that Ruby is so simple to learn and has attacted many people through Rails, and this gives some devs a false feeling of confidence. I have had my share of time spent wading through other people's bug-ridden, ill-architected Ruby gems, but then if anything it's taught me to be careful. [1] http://irb.no/ http://irb.no/
- Ingaz 14y agoI think that ruby, perl, python and javascript are similar only in purely theoretical way. Python - is "executable pseudoscript". It does not have ruby elegance, perl "worse is better", javascript ... minimalism(?) I'm using python for prototyping. As communication tool. I can describe all python scetches to every programmer, be it javer, c-sharper, C-developer or SQL-er. Can I use perl/ruby/CSharp/Java/F#/Haskel? Answer is NO. Perl: sigils, regexp everywhere (when it not needed), parameters passing, "use strict", strange OOP - all those features makes it impossible for prototyping. Ruby: it's the same as for perl. It looks more pleasant to eyes but it is no way "pseudocode" that everybody can read. C#/Java - prototyping is a joke. And I can't use sharp-code for javer and otherway. F# - F# is looking a lot like "pseudo-script". But the main strength - type system is not helping in prototyping. LISPs - I think that LISPs are good for prototyping. The only problem - they are LISPs.
- philwelch 14y ago> Perl: sigils, regexp everywhere (when it not needed), parameters passing, "use strict", strange OOP - all those features makes it impossible for prototyping. > Ruby: it's the same as for perl Nothing you said about Perl can be applied to Ruby.
- Ingaz 14y ago"The same" means "ruby as pseudocode is the same as perl". You need to explain that 0 is True. You need to explain blocks, (int_number).times and other cute things. And I heard a lot of complains for whitespace, but begin-end is more irritable for many.
- technomancy 14y ago> You need to explain that 0 is True. Easy: it's not C. The idea that zero is false only makes sense if you're trying to code very close to the metal. To everyone else it's baffling.
- philwelch 14y ago> "The same" means "ruby as pseudocode is the same as perl". Right, except none of the reasons you gave for why perl is a poor pseudocode apply to Ruby, so you need to make that point yourself. > You need to explain that 0 is True. The truth values of integers don't usually come up in pseudocode. > You need to explain blocks, (int_number).times and other cute things I agree that the concept of passing around a block of code is hard to implement in less expressive languages, though cases like "each" and "map" can be simply translated to for loops. You could make the same criticism about Python's lambdas or list comprehensions. n.times is perfectly useful pseudocode, though. Think of it as a shorthand for "for(i = 0, i < n; i++)".