News for hackers. Stuff that matters.
Re:Ruby is beautiful (but I'm moving to Python) by 16s on Monday November 29, 2010 @12:20PM (#1950999)
Ruby is nicer to read than Python. Here's how each language reverses a string:

# Ruby

string.reverse()

# Python

string[::-1]

Which looks better?

Edit: I'm not sure why this is being down voted. It's a true statement.

Edit2: With all the down voting on Hacker News recently, I'm about to quit sharing my knowledge here. Maybe pg will do something about this. It needs to change otherwise good people will stop posting here.

Edit3:

irb(main):002:0> x = "hacker"

irb(main):003:0> puts x.reverse()

rekcah

>>> x = "hacker"

>>> print x[::-1]

rekcah

Re:Ruby is beautiful (but I'm moving to Python) by anthonyb on Monday November 29, 2010 @05:49PM (#1952156)
I think possibly because it's 'fiddling around the edges'. Sure, it's nice to have a way to reverse a string, but you don't do that very often in practice - assigning to lists, calling functions, etc. are all far more common.

But yeah, I hear you on the downvoting.