News for hackers. Stuff that matters.
Re:Why Python is Important for You by wging on Saturday February 11, 2012 @03:16PM (#3580041)
As a commenter on the article wrote: what about Ruby?

I say this as a happy Python user. Ruby seems very similar but I'm reminded of a pg essay on language power: looking up the power curve, you see '$Language plus a bit of weird stuff that is probably irrelevant.' So I don't trust myself.

As someone who loves Python and doesn't know any Ruby beyond a few bits of syntax and the obvious bits that are common to most languages, what am I missing?

Re:Why Python is Important for You by tripzilch on Saturday February 11, 2012 @05:31PM (#3580374)
Some many years ago I decided I should learn a new scripting language because PHP wasn't general-purpose enough. I decided it would be either Python, Ruby or Perl. For some reason Perl was dropped early, I forget why (don't worry I learned some Perl later).

So I started Googling for Python vs Ruby. After checking some language basics tutorials, I decided that really, for my purposes they were about equivalent in power (didn't know much about library support yet).

The one thing that pushed me towards Python was that most articles I could find comparing Ruby and Python were written by a happy user of one of these languages. However, all Python users wrote something like "I guess you can do everything in either of them, it's just a matter of preference and I happen to have picked Python", while the Ruby users tended to be somewhat more flaming and arrogant about it, especially in the comments sections.

In the end I went with Python because the community seemed more friendly. However, I stayed for the library support. Especially after that one time I installed pyTwitter and I could just do `import twitter`, I was pretty impressed by that (I assume Ruby has an excellent Twitter lib too, btw).

Also, just a little disclaimer: This was a couple of years back (I forget how many, 5 or so) maybe the Ruby community changed, and it's also totally possible that I just happened to land on a rather "particular" region of the Ruby blogosphere, so take this cum grano salis. I had to make a choice and was about this close to just flipping a coin over it :)

Re:Why Python is Important for You by jamesbritt on Saturday February 11, 2012 @08:20PM (#3580734)
Also, just a little disclaimer: This was a couple of years back (I forget how many, 5 or so) maybe the Ruby community changed, and it's also totally possible that I just happened to land on a rather "particular" region of the Ruby blogosphere, so take this cum grano salis. I had to make a choice and was about this close to just flipping a coin over it :)

ruby-talk used to have, as one of a number of perma-threads, the question of "Why Ruby over Python". The discussion was almost always entirely civil, with most people suggesting that the questioner try both for a bit and pick the one that clicked best.

I used to host (on ruby-doc.org) a page called "Ruby Eye for the Python Guy" that tried to summarise the comments and offer links to help folks make a decision.

The community on ruby-talk at that time (probably 5 years ago) was extremely polite and helpful, and I'm sorry you landed on some opinionated blog that likely only reflected a small group of developers.

I don't follow ruby-talk much any more, so I can't say how it is, but there has always been a pretty strong tradition of MINSWAN: "matz is nice so we are nice." I expect that's still encouraged. There are, of course, various sub-groups around this or that library or framework that may have zero exposure to that, think they're the shit, etc., but I hope people considering Ruby don't a priori dismiss the majority of Rubyists as rude because of bad reports about a handful of people.

OK, end of Ruby PSA.

Side note: I'm often puzzled by people who think a language or framework or whatever geek thing has to "win." Be happy for happy people.

Re:Why Python is Important for You by tikhonj on Sunday February 12, 2012 @02:28AM (#3581334)
Well, one issue is that with a language as popular as Python (or Ruby or Java...) it's relatively hard to avoid working with them. So it's actually very beneficial if a technology one likes becomes popular.
Re:Why Python is Important for You by mkopinsky on Saturday February 11, 2012 @11:47PM (#3581125)
Call me a cynic, but I'm weirded out by the idea that the only reason for civility is to emulate an idol who is civil.
Re:Why Python is Important for You by jamesbritt on Sunday February 12, 2012 @02:38AM (#3581343)
Call me a cynic, but I'm weirded out by the idea that the only reason for civility is to emulate an idol who is civil.

Idol? He's a nice guy who does admirable work and many people think it ungracious to be rude when publicly discussing his language.

Only reason? Geeks get into stupid pissing matches. Sometimes a little reminder is a good thing, that's all.

Re:Why Python is Important for You by espeed on Saturday February 11, 2012 @03:37PM (#3580091)
Library support.

For example, there really is no Ruby equivalent to SciPy, NumPy, Matplotlib or NLTK (http://news.ycombinator.com/item?id=3179370). However, there has been some effort in the Ruby community to begin the process of developing some of these libraries (see SciRuby http://news.ycombinator.com/item?id=3180369). but the Python libraries have been in development for years so this will be no easy feat.

Re:Why Python is Important for You by wging on Sunday February 12, 2012 @04:40AM (#3581473)
As a user of Sage (http://sagemath.org/) I can appreciate that. Nice to have what you need at your fingertips.
Re:Why Python is Important for You by berntb on Saturday February 11, 2012 @03:51PM (#3580124)
>> Library support.

Isn't that rather an argument for Java or Perl?

What I don't get is the cheerleading for Python? Ruby has/had something similar going with Rails. I mean, the article even notes that it is a middle of the road choice, optimised to not be extreme.

Re:Why Python is Important for You by amcintyre on Saturday February 11, 2012 @05:15PM (#3580331)
I suppose it depends on the libraries and what you want to do with them. I personally find the Python REPL in combination with matplotlib, NumPy and SciPy to be extremely handy for poking around in small/medium-sized data sets and debugging numerical apps. Python "stays out of my way" a lot better than Java or C++ would for this ad-hoc kind of exploration.

I'm sure there are probably tons of nice alternatives to Python for this kind of work, and there are tasks that other people need to do for which trying to use Python and some readily-available libs just wouldn't be sufficient. I only suggest Python to people whom I know are doing work where it would be helpful; there's no point in pushing it as a one-size-fits-all solution.

Re:Why Python is Important for You by espeed on Saturday February 11, 2012 @03:58PM (#3580138)
Yes, Java and Perl have large libraries, but wging asked what he would be missing going from Python to Ruby -- missing libraries is the big one.
Re:Why Python is Important for You by pjscott on Saturday February 11, 2012 @03:54PM (#3580129)
It's an argument for any language that has libraries available, weighted by your need for those particular libraries and their quality.
Re:Why Python is Important for You by achompas on Saturday February 11, 2012 @04:01PM (#3580144)
Right, in addition to the usual efficiency concerns (can you afford that 0.5-1s of JVM spinup? do you need mature multiprocessing libraries?)
Re:Why Python is Important for You by lelele on Saturday February 11, 2012 @07:59PM (#3580699)
> Isn't that rather an argument for Java or Perl?

No, because then you'd have to stand either Java or Perl. If you are looking for a language to learn beyond a quick hack, then the language matters more than its libraries. I know Perl, and everybody knows what a boon CPAN is, but still for scripting tasks I have switched to Python. It would have made me feel sick to keep programming in Perl.

As I had to choose between Python and Ruby too, besides the library thing, I picked Python because Ruby seemed like it was trying too hard to be powerful and expressive, to the detriment of clarity. I didn't want to invest too much time in learning a scripting language. It's just for scripting, you know, it's not meant to accomplish much. If I need a powerful and expressive language, then I just reach for the big guns.

Re:Why Python is Important for You by jamesbritt on Saturday February 11, 2012 @08:21PM (#3580737)
Isn't that rather an argument for Java or Perl?

Or JRuby.

Re:Why Python is Important for You by pbreit on Saturday February 11, 2012 @04:56PM (#3580293)
No, it's an argument for python over ruby.
Re:Why Python is Important for You by wcarss on Saturday February 11, 2012 @04:20PM (#3580199)
Ruby's blocks and built in regular-expressions are two examples of things you're missing.

if result =~ /regex/

that kind of thing is awesome for readability, but it can also be pretty darn slow.

There's also some interesting things about the ruby object model and interpreter that are different from python's approach. Whereas in the python REPL you type help(object) to get the docs on that object, in ruby you type object.methods or object.public_methods, etc. It's less documentation oriented, and more code-exploration oriented, but the two end up delivering the same sort of information.

Hope that's helpful! Ruby's a lot of fun to tool around with, and there are (in my opinion) fewer things about it to trip you up completely than there are when first learning python. But once you use it for a while and get beyond the basics, it becomes clear that there's a lot of unfocused cruft foating about, which fits no rhyme nor reason. Much more than Python has.

(cautionary note: I'm not an expert with either language)

Re:Why Python is Important for You by zem on Saturday February 11, 2012 @07:02PM (#3580562)
ruby does have its share of cruft, but it also has some inspired features that make a far bigger difference than you'd think they would. blocks are the biggest (specifically, syntactic support for attaching a lexical closure to every method call, which the object can choose to use or not), but here's another cute one: the case statement

    case object   
      when matcher1; ...   
      when matcher2; ...   
    end
performs a method call on the matchers, with the object as an argument, rather than vice versa. so you can say things like

    case name
      when "John Smith"; puts "hello again"
      when / Smith$/; puts "are you related to john?"
    end
the string "John Smith" and the regexp / Smith$/ will each call a different matcher to see if they match your name - a far cleaner design than the string class having to provide matchers for everything you might want to use in a case statement.
Re:Why Python is Important for You by shazow on Saturday February 11, 2012 @04:33PM (#3580240)
Have a look at IPython for a more code-exploration oriented experience.

http://en.wikipedia.org/wiki/Ipython (Sadly the homepage doesn't quite get the simpler sell points across as well. http://ipython.org/)

Re:Why Python is Important for You by hcarvalhoalves on Saturday February 11, 2012 @07:20PM (#3580599)
As a programmer who knows both languages, while I like regex as a native type with it's own notation, I don't miss ruby blocks at all. Most Ruby code I see abuses blocks pretty badly instead of refactoring behaviour into a function, and soon you have a code base littered with the same algorithm over and over again. I think Guido has a point on making lambdas one-liners exclusively.

Also, Ruby programmers talk about how readable Ruby is, but I disagree. The lack of consistency between using parenthesis or not, how to separate arguments, or even string formating syntax makes reading Ruby code wrote by someone else much more prone to "WTF" moments than Python.

Re:Why Python is Important for You by maxerickson on Saturday February 11, 2012 @05:59PM (#3580439)
It sounds like object.public_methods and object.methods are a lot like dir(object) in python.
Re:Why Python is Important for You by alinajaf on Saturday February 11, 2012 @04:09PM (#3580168)
I'm an extremely happy ruby user but have nothing against python, it's just that the languages operate at such a similar level of abstraction that it seems like a bit of a waste to spend time learning python when I could be learning C or Haskell.

FWIW though, I get serious library envy, especially with regard to NLTK. Ruby has web development cornered but is decades behind python when it comes to anything around machine learning and scientific computing.

Re:Why Python is Important for You by pwang on Saturday February 11, 2012 @09:43PM (#3580943)
> Ruby has web development cornered but is decades behind python when it comes to anything around machine learning and scientific computing.

The irony of this is that many folks in the Python scientific computing space pine for better syntax extension facilities so that they could do more "natural" DSLs for data analysis and embedding math inside Python code.

The object lesson here is that communities and passionate users matter. Python took root in some scientific computing environments and certain dedicated individuals built up a software library and invested in growing a community that is now a force to be reckoned with. If the same people had all chosen Ruby and built a community around that, there is no obvious reason why Ruby shouldn't be the one with the great scientific libraries.

Re:Why Python is Important for You by masklinn on Saturday February 11, 2012 @04:03PM (#3580150)
The downside of Ruby is the third-party packages, especially advanced/industrial-strength stuff (NumPy/SciPy for instance).

The main upside of Ruby is blocks, however limited (compared to Smalltalk's) the ability to craft your own control structures is incredibly powerful and empowering (and you can't really do that in Python, you can abuse decorators for it nowadays but it's not exactly sexy or readable, or generally a good idea)

Ruby also makes metaprogramming easier and more common, though the jury's still out on whether it's a good thing or not.

Re:Why Python is Important for You by jshen on Saturday February 11, 2012 @04:51PM (#3580280)
I'd also say that ruby has done a better job of moving forward. Compare ruby 1.9 to python 3. I think JRuby is more mature than jpython, and I know this will start the flames, but I think ruby is clearly better for web stuff; not just rails, but the whole ecosystem. Edit: I also think bundler is better than what is going on in python land.
Re:Why Python is Important for You by Daishiman on Saturday February 11, 2012 @05:11PM (#3580325)
I would say that the policy of rapid movement it has its ups and downsides; Python code is generally very stable between versions and breakage is well-documented. So far I haven't seen the same thing going on in Ruby land.

JRuby is clearly more advanced that Jython. I'm guessing that with the advance of PyPy, other Python interpreters just aren't getting that much attention, which is a bit unfortunate.

Re:Why Python is Important for You by jshen on Saturday February 11, 2012 @05:48PM (#3580416)
rapid movement definitely has it's downsides. However, I don't know what you mean when you say that ruby code isn't stable between versions. Do you mean between versions of ruby? If so, again, the transition from ruby 1.8 to ruby 1.9 was much much better than the transition from python 2 to python 3.
Re:Why Python is Important for You by sunqiang on Saturday February 11, 2012 @07:56PM (#3580689)
Python 2 to Python 3 is a big jump once in a lifetime. what about ruby 1.9 to ruby 2.0?
Re:Why Python is Important for You by jshen on Saturday February 11, 2012 @08:30PM (#3580764)
ruby 2.0 will likely be just as easy as 1.8 to 1.9, if not easier.
Re:Why Python is Important for You by sunqiang on Saturday February 11, 2012 @09:49PM (#3580954)
so, it's not as easy as python 2.x to 2.(x+1) and python 3.x to 3.(x+1). will every version update of Ruby will suffer as mush as Ruby 1.8 to 1.9?
Re:Why Python is Important for You by masklinn on Saturday February 11, 2012 @05:30PM (#3580369)
> Compare ruby 1.9 to python 3.

They're not comparable, so no.

> I think JRuby is more mature than jpython

Pretty different situations, from 2006 to 2009 two lead JRuby developers were hired specifically for that by Sun (later left for EngineYard) and a third was hired by ThoughtWorks for the same.

For Jython this only happened in 2008, after the project had pretty much gone on freeze due to the original founder leaving to work on the Pypy project.

Compare IronPython to IronRuby instead, and the situation is reversed. Same if you compare Rubinius and Pypy.

> and I know this will start the flames, but I think ruby is clearly better for web stuff

That's your personal judgement, I don't agree.

Re:Why Python is Important for You by jshen on Saturday February 11, 2012 @05:36PM (#3580385)
You dodged the first two issues. Python 3 is causing serious pain, does django work with it yet?

Second, who cares why JRuby is more mature, it is.

Re:Why Python is Important for You by masklinn on Saturday February 11, 2012 @05:52PM (#3580425)
> You dodged the first two issues.

No (and screw you for your unwarranted downvote you ass)

> Python 3 is causing serious pain, does django work with it yet?

I did not deny that, I denied your equation of Python 3 with Ruby 1.9 when they have absolutely nothing in common and had very different goals.

> Second, who cares why JRuby is more mature, it is.

That's not the issue with your question, the issue is that you cherrypick a single alternative implementation which supports whatever claim you're trying to make and ignore all others. That makes your claim both dishonest and irrelevant.

IronPython is more mature than IronRuby, Pypy is more mature than Rubinius, by your comment that makes 2 for 1 therefore Python is superior to Ruby right? That's nonsense, because your original assertion is nonsense.

But hey, at the end of the day I couldn't expect much more from somebody who decided to turn a discussion on relative merits into a dick-size contest. I guess the western ruby community has not matured as much as I thought it did. Thanks for bringing me back to reality.

Re:Why Python is Important for You by jshen on Saturday February 11, 2012 @05:59PM (#3580438)
I didn't down vote you, it seems HN doesn't allow me to down vote on threads I'm participating in. If it did, I'd down vote your last comment.

I think the JVM is the more significant platform compared to the clr and rubinius/pypy. Therefore I think it's maturity is more significant.

Re:Why Python is Important for You by sunqiang on Saturday February 11, 2012 @07:45PM (#3580658)
The PyPy team is amazing, for example Quora is now running on PyPy. and it's easy for a Python programmer run PyPy as an alternative(and hopefully fast) implementation.
Re:Why Python is Important for You by ramblerman on Sunday February 12, 2012 @05:42AM (#3581545)
It's ironic that you would point the finger at communities for not being mature.

Yours is by far the least pleasant and counterproductive thread on this entire discussion

Re:Why Python is Important for You by chernevik on Saturday February 11, 2012 @08:04PM (#3580705)
Ruby/Rails seems to have a more developer-friendly approach to the web development stack than Python/Django. (I am but an egg, more comfortable in Python/Django but learning Ruby/Rails, I wouldn't argue with more experienced folks about any of the following.)

Ruby/Rails seems easier to develop and test the full stack application, from client JavaScript to server Ruby response and back. It supports Ajax through injection of injection of JavaScript into HTTP responses served up, based on specifications in server side code. The test architectures seem to reach across the client/server divide, for example checking server side responses to triggering client-side JavaScript.

Python/Django are trying, with like lettuce and splinter, but these don't yet seem to be quite to the same standard.

Also, because RoR has a lead on web development, new developments in that space seem generally better integrated. For example, Backbone is a young JavaScript MVC style framework for client side development. I've just been fooling with using it with Django, and discovered that its stringification of Json objects for POST doesn't work with Django's parsing of the client request. Maybe more experienced developers spotted and fixed this easily -- my fix is only a couple of lines -- but it's the sort of thing that makes me wonder just how many folks have tried to integrate Django w/ Backbone. I'm guessing that the Backbone community has already spotted and fixed any such issues with RoR.

Now I'm not sure how I feel about RoR, it often feels like magic and I'm a little suspicious of stuff like super-convenient JavaScript injection. Maybe when I understand it better it will seems less magical and more convenient. But it isn't hard to see why the web development community likes it.

Re:Why Python is Important for You by alinajaf on Sunday February 12, 2012 @06:18AM (#3581577)
RE: javascript injection, it's totally optional and in years of doing rails dev work I've never used it (I presume you're talking about the 'remote' option).

Actually, the vast majority of my rails stuff recently has been RESTish (or at least Backbone compatible) json endpoints with a CoffeeScript frontend.

The front and back end in that case are totally decoupled (though rails does do some nice things to help you organize your frontend code).

This would have been hard a few years ago but I've found that as time has wore on rails has become quite a bit more forgiving when you disagree with DHH, e.g.. you can use whatever templating language, testing framework or ORM you like, and there will be others who made the same choice you can look to for support. It's still opinionated about defaults, but you can switch out whatever libraries you like these days, for the most part.

Re:Why Python is Important for You by funksta on Sunday February 12, 2012 @01:45AM (#3581291)
One of the differences between Django and Rails is that the former makes almost no assumptions about how you are going to write your front end. I don't know much about Rails, but it seems to me that it is much more opinionated in that regard.

Re: Django & Backbone, you should check out djangbone. It makes it dead simple to create a basic backbone-compatible APIs in Django, and is easy to extend if you need more advanced functionality (full disclosure- I'm its author): https://github.com/af/djangbone

Re:Why Python is Important for You by thehotelambush on Saturday February 11, 2012 @06:15PM (#3580469)
I used Python for a really long time and switched to Ruby several months ago. Benefits of Ruby are:

-no distinction between expression and statement (everything has a value)

-lambdas can thus contain any expression

-much bigger range of built-in methods and classes (all permutations of a list, removing duplicates from a list, Rational class, Regexp class, Range class, etc.)

-more flexible syntax and "control operators" like each_with_index

-almost zero distinction between built-in classes and methods and user-written ones: you can open up Hash (dict) or Array (list) and extend it straightforwardly.

Downsides are:

-generally uglier and more ambiguous syntax

-distinction between functions and methods (b/c "all you can do is send a message") leads to a lot of unnecessary duplication of concepts

-so-called "blocks" which are really just a hack to avoid writing the word "lambda" a bunch of times (maybe if the more concise Ruby 1.9 syntax for lambdas had existed earlier blocks wouldn't have been implemented). I think they are based on the idea that most HOFs only require one functional argument, and they encourage functional programming, but they (along with the last bullet point) discourage the general case. They provide some of the functionality of macros.

-you can't define a class inside a method (still haven't quite figured out the reasoning behind this one).

In general Ruby is definitely more powerful than Python, but in its higher ambitions suffers more obviously from clashes between functional and OO programming. Python's dogmatic insistence on "readability" makes it feel like an old grandma in comparison to Ruby.

Re:Why Python is Important for You by codesuela on Saturday February 11, 2012 @06:48PM (#3580527)
> -lambdas can thus contain any expression

why would you want to use lambdas if you have generator expressions? eg:

map(lambda c: c.strip(), countries.split(','))

vs

[c.strip() for c in countries.split(',')]

IMHO the latter one is way more readable and generators cover almost all the use cases for lambdas. If you could not do it with a generator expression and choose to use a anonymous function it should have been a method anyway.

> -much bigger range of built-in methods and classes (all permutations of a list, removing duplicates from a list, Rational class, Regexp class, Range class, etc.)

you mean sets, dictionaries(hashtables) etc.? those are built in as well in Python.

Remove duplicates: mylist = list(set(mylist))

Range class: [i for i in range(10)]

you can import the rational class via a simple from fractions import Fraction

same for regex

> -more flexible syntax and "control operators" like each_with_index

you can iterate over dictionaries with for k,v in dict.items()

if you need the index of a list you can use for i,v in enumerate(list)

personally I don't think there is much of a difference between Python and Ruby. One is more mature the other is way hipper and it comes down personal taste which one you choose.

Re:Why Python is Important for You by haberman on Saturday February 11, 2012 @07:05PM (#3580570)
> why would you want to use lambdas if you have generator expressions?

Lambdas (blocks) in Ruby are used for way, way more than just building or manipulating lists. For example, there is no need for the "with" keyword in Ruby, because you can just use blocks for that. As another example, you can specify a block to the Hash constructor to specify code that runs when a key is accessed that is not present.

> Range class: [i for i in range(10)]

That is not a range class, that is an expression for constructing a contiguous list of numbers. The Range class in Ruby is an actual class that you can instantiate and call methods on.

  ("a".."z").cover?("c")    #=> true
  ("a".."z").cover?("5")    #=> false
> personally I don't think there is much of a difference between Python and Ruby. One is more mature the other is way hipper and it comes down personal taste which one you choose.

They have similar capabilities but make very different choices in a lot of ways.

Re:Why Python is Important for You by thehotelambush on Saturday February 11, 2012 @07:59PM (#3580698)
Thanks for mentioning sets - this is another thing that I would like to be built-in in Ruby. But "list(set(mylist))" seems like kind of a hack.

> you can import the rational class via a simple from fractions import Fraction

Sure, you can write a library for anything and by now Python has libraries for most everything. But it still makes a difference to have things in the core language, plus a nice syntax for them.

> why would you want to use lambdas if you have generator expressions?

This is a case of making up for odd semantic choices with special syntax, which then becomes an unnecessarily fixed-in-stone part of the language. Range objects in Ruby are actually like slice objects in Python. But Ruby separates the syntax for ranges from the get-item method, since there are plenty of other places where you would want to use ranges (then you can iterate and map over them, etc.).

Ruby uses blocks to implement things like an each method that fulfills the same function as Python's for statement. (Ruby has a for statement but it is hardly ever used.) In Ruby your example would be

countries.split(',').map &:strip

which is obviously more concise and no less readable. Compare with

countries.split(',').each &:foo

where foo is some side-effectful method.

IMO such a small change in behavior should result in a similarly small change in how the program is written.

Re:Why Python is Important for You by nathan_f77 on Sunday February 12, 2012 @07:39AM (#3581665)
Ruby does have sets:

    require 'set'
    Set.new([1,2,3])
Re:Why Python is Important for You by wging on Saturday February 11, 2012 @11:08PM (#3581073)
>Range class: [i for i in range(10)]

How does this differ from list(range(10)) (besides being highly suggestive of the power of list comprehensions)?

>IMHO the latter one is way more readable and generators cover almost all the use cases for lambdas. If you could not do it with a generator expression and choose to use a anonymous function it should have been a method anyway.

This is actually why Guido van Rossum wanted to remove lambda from the core language: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 (He didn't, thankfully. I still want reduce back in 3.x, though.)

Re:Why Python is Important for You by candl on Sunday February 12, 2012 @09:49AM (#3581909)
I did a switch in a reverse direction. From Ruby to Python. People actually shouldn't compare both languages in terms of language constructs and what or what not they got right. They are similar enough that it doesn't matter. What matters is library support and the community.

I got into Ruby by pure accident (No Rails-bait). I needed a scripting language to automate some tasks and one of my friends was playing with it back then and suggested it.

Ruby's weakness (and it's strength at the same time) is that it got popularized by Rails. As a result a huge community has grown around it - but it brought a tunnel vision effect along with it. People don't recognize that there are things besides Rails and it's reflected in weak (non web-dev) library support.

I didn't like the fact that there's a big push in Ruby-land for metaprogramming / DSLs and monkey patching. Ruby's not inherently that great at it. It just happens that you can do it, but it doesn't mean you should. Which has always been in my eyes mostly a big abuse of *_eval, method_missing etc. that leads to performance issues, maintainability issues, and so on. All that just to save a few keystrokes. Couple that with the very implicit nature of Ruby then you get a disaster. How often did I want to use libraries that turned out to be monkey-patching the same built-in classes and clashing with each other, How often did I want to delve to some code base to customize something, make a fix, etc. just to find such coding practices and being unable to reason about it in a regular object oriented fashion which Ruby's foundations are built on.

The more I wanted to build serious things in Ruby the more often I would hit such problems.

This all brings a question: What would happen if Rails had disappeared the next day. What would all these people do? What could they use instead?

It was an obvious choice not to stick with Ruby because it has nothing to offer in the long term over Python. Learning python is a very good investment - I can do web programming, gui programming, scientific computing. I can use it to script blender, gimp, you name it. And unlike Ruby - I have excellent alternatives for each task.

Re:Why Python is Important for You by cheald on Saturday February 11, 2012 @06:29PM (#3580500)
Ruby is Python's slutty sister. She's just as hot, but she'll let you do things to her that Python would dump you for even trying.
Re:Why Python is Important for You by nO0b on Saturday February 11, 2012 @04:27PM (#3580226)
Blocks.

Ruby gets a lot of things wrong, but blocks are one thing they more or less do well. Everything good that has been built from/for Ruby owes a large measure of its success to Ruby's block implementation.

Python programmers are definitely looking up the power curve at Ruby.

Re:Why Python is Important for You by elektronaut on Saturday February 11, 2012 @03:32PM (#3580083)
I think you could pretty much substitute Python and Django with Ruby and Rails, and the article would still ring true. As a Ruby developer I've only had brief encounters with Python, but to me it seems like a language I would love for the same reasons I like Ruby.
Re:Why Python is Important for You by overgard on Saturday February 11, 2012 @09:10PM (#3580866)
As a Python user, I'll give my personal reason for using Python over Ruby. Upfront: I think Ruby is absolutely fantastic. It's a very elegant language. In a lot of ways I think it's cleaner than python. I'd love to use it.

Except...

Every interpreter I've tried is just too slow. I recently ported over a networking library I wrote in python to ruby, and the requests per second (CPU limited in this case, since it was talking over a loopback socket -- this was just a test of how fast data could be serialized/deserialized) dropped from 7000 requests/sec in python to 120 in ruby. And that was just with standard CPython. Under PyPy, I was able to process about 20,000 requests/sec after letting the JIT warm up.

I realize it's sort of silly to choose a dynamically typed interpreted language on the grounds of performance when you're already giving up so much performance regardless, but in my mind python hits the sweet spot of "just fast enough for most things I need to do", and with all other things being roughly equal (which, in my opinion, they roughly are), being an order of a magnitude factor faster wins out.

Re:Why Python is Important for You by biafra on Saturday February 11, 2012 @10:40PM (#3581023)
Did you give JRuby a try?
Re:Why Python is Important for You by overgard on Sunday February 12, 2012 @12:24AM (#3581177)
I didn't. Perhaps I should, but it seemed like it would have to be at least 10x faster than YARV to be worth it, which looking at the benchmarks seemed unlikely (but who knows? maybe I was hitting some sort of interpreter specific bottleneck)
Re:Why Python is Important for You by attractivechaos on Sunday February 12, 2012 @09:47AM (#3581906)
For some tasks, JRuby is faster than python and for others, it is slower, but the difference is not big. PyPy is significantly faster in most cases than both.
Re:Why Python is Important for You by jshen on Sunday February 12, 2012 @11:40AM (#3582190)
Is this code public?
Re:Why Python is Important for You by Game_Ender on Saturday February 11, 2012 @03:23PM (#3580053)
In my opinion Ruby has a slightly more obscure syntax with custom symbols, and it's C API is not as clean and well put together as Python's.
Re:Why Python is Important for You by 16s on Saturday February 11, 2012 @06:25PM (#3580490)
Which is more obscure?

Reverse a string in ruby: string.reverse()

Reverse a string in python: string[::-1]

Re:Why Python is Important for You by evincarofautumn on Saturday February 11, 2012 @06:52PM (#3580542)
Slice syntax in Python always bothered me. This would be slightly more readable:

    ''.join(reversed(string))
Except it requires you to have an idea of how iteration works (beginners don’t) and why that “join” needs to be there, and it’s still an order of magnitude slower. But hey. Ruby is prettier in some ways, Python in others, and beggars, as they say, can’t be choosers.
Re:Why Python is Important for You by 16s on Saturday February 11, 2012 @06:55PM (#3580547)
Way way slower than the slicing.
Re:Why Python is Important for You by TylerE on Saturday February 11, 2012 @07:44PM (#3580651)
What an odd example. Other than perhaps a palindrome detector, I'm having a really hard time coming up with a use for a reversed-strings. Python DOES provide a reverse for arrays.
Re:Why Python is Important for You by rue on Sunday February 12, 2012 @01:42AM (#3581283)
> As someone who loves Python and doesn't know any Ruby beyond a few bits of syntax and the obvious bits that are common to most languages, what am I missing?

Nothing. Everyone jokes about turing completeness, but Ruby and Python are pretty much exactly equivalent for their users. Python's got the upper hand in some areas, Ruby in others, but you'll get it done.

If Python works for you, use it. I didn't like it, the object model/runtime never felt right[1]. Ruby's did, it's internally consistent.

[1] The classic len(str), the underscored methods, recently decorators…

Re:Why Python is Important for You by hello_moto on Saturday February 11, 2012 @03:54PM (#3580128)
That depends on your taste buds. Mine prefer consistency. Ruby is a alippery slope when it comes to consistency and it requires the whole community to change certain attitudes.
Re:Why Python is Important for You by jimbokun on Saturday February 11, 2012 @10:03PM (#3580977)
Ruby seems more consistent to me, as it follows the "everything is an object" design principle quite rigorously. Python does not have any consistent design principle like that at its core, as far as I can tell.
Re:Why Python is Important for You by hello_moto on Saturday February 11, 2012 @11:03PM (#3581066)
This is something that I struggle a lot between Ruby, Python, and JavaScript.

Ruby/JS everything "is an object" is definitely consistent when it comes to "design principle". But somehow I just can't grok/remember/stick to my head every time I read Ruby/JS code.

I suppose as a user, I'm more concern with the readability (a.k.a coding style) more than the "everything is an object".

Re:Why Python is Important for You by petercooper on Saturday February 11, 2012 @11:48PM (#3581129)
A key difference is that Ruby picks one paradigm (object oriented programming) and sticks with it (to a fault, potentially) whereas Python takes a multiple paradigm approach and various styles tend to be mixed together even in the best of conditions (consider len(str) vs str.length). You can attempt to ignore OO in Ruby but it's not recommended and under the hood, everything you're doing is forced into an OO paradigm anyway.
Re:Why Python is Important for You by bconway on Saturday February 11, 2012 @07:59PM (#3580696)
As the author points out, a huge standard library. Sure, Ruby has everything you need if you pull in this gem and that gem, but you better hope the gem you need is working that week or you're going to waste a lot of time reading Github logs and back-tracking revisions.
Re:Why Python is Important for You by njharman on Sunday February 12, 2012 @02:24AM (#3581327)
If the distance between Ruby and Python is the Moon and Earth. Then the distance between Ruby/Python and any other common language is the Earth and Sun.

You aren't missing much, comparatively.

Re:Why Python is Important for You by chaostheory on Sunday February 12, 2012 @02:58PM (#3582787)
I've used both. What you're missing out on is a better ecosystem of libraries and a community that communicates more and better than Python's imho.
Re:Why Python is Important for You by wging on Saturday February 11, 2012 @10:49PM (#3581044)
I should probably point out that the bit I put in single quotes is not a verbatim quote.