Hacker News new | past | comments | ask | show | jobs | submit login

I was a long time Rubyist but switched over to Python because even though its characteristics and philosophy made me reflexively shirk it at first -- particularly significant whitespace, one-line-lambdas, and the clusterfuck of 2.x vs 3.x -- it seemed to me to be an obviously easier language to teach, nevermind its significantly stronger libraries for numerical work.

I'm glad I made that decision. The language was easy enough to pick up in my spare time. I hardly ever use pandas/numpy unless I'm doing some really serious statistical work; the core language and patterns in Python are now pleasant enough for me to use in day-to-day data wrangling and hacking. I'm now mixing in Ruby for a current project -- mostly because I like Rakefiles, and also, Ruby's static site generators like Middleman -- and it's been surprisingly painful to do things in Ruby. I used to hate how when doing a Google search for something in the Python stdlib would bring up 2.x before 3.x...but it almost seems even more problematic in Ruby, where 1.9.3 and 2.0.0 docs keep coming up, even though official maintenance of them has been dropped.

(2.0's maintenance ended in Feb. 2016 http://ruby-doc.org/core-2.0.0/Array.html)

If I didn't know better, I wouldn't even know what Ruby's official version was. For me, Google results show no other documentation for Ruby's Array, as the next results are from tutorialspoint and sitepoint.

And that's not even getting into the issue of how problematic the do-things-how-you-like freedom of Ruby is incredibly hard to discern as an outsider. To give one example I recently had: how do you iterate through a human-calendar-based time interval, such as a month (i.e. any interval that doesn't have a constant length in seconds)?

In Python, I remember how frustrating it was to figure out what the hell the difference was between datetime, time, calendar, the gmtime function, and then timedelta, and then the third-party libraries of pytz and python-dateutil. But once I understood them, which was largely a matter of realizing how naive I was about the nature of measuring time, doing something like iterating over calendar intervals is straightforward.

This is my first Google result for "python iterate month intervals" -- it's from 2008 and still works perfectly: http://stackoverflow.com/questions/153584/how-to-iterate-ove...

Now here's the result for Ruby; all of the answers, as far as I can tell, are not only not-very-Rubyish, but not reliable either: http://stackoverflow.com/questions/1724639/iterate-every-mon...

FWIW, I remember solving this problem by using the DateTimein ActiveSupport. Which is a credit to how much fun and joy it is to build things in Rails right out of the box. But that complexity catches up quick, and including ActiveSupport in day-to-day Ruby work can sometimes to unwanted monkeypatching.




As a Ruby fan who is baffled by Python's continued popularity, I like this comment - I'm always interested to hear why people have such different experiences than me trying to move from the former to the latter.

That said, unless "recently" was years and years ago, Date#next_month is a thing:

  require 'date'
  date = Date.today
  while (date < Date.today.next_year)
    puts date
    date = date.next_month
  end
One thing that I think throws a lot of people is that the official Ruby docs are actually better than Google for figuring stuff like this out - it only takes a couple minutes to find #next_month by perusing the method listing at http://ruby-doc.org/stdlib-2.3.1/libdoc/date/rdoc/Date.html, but do a web search and you get a bunch of Railsy crap.

Though I will grant you that even searches on ruby-doc.org keep bringing up results for Ruby 2.0.x and whatnot. That part is pretty bizarre.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: