Re:Ruby is beautiful (but I'm moving to Python)
by anthonyb on Monday November 29, 2010 @05:39PM
(#1952117)
> Python still scores far lower on my readability scale. It's seems like it's halfway to being minified, the lines are chock-a-block.
That's likely because you're not used to reading Python. For me, Ruby seems unreadable - you have all these weird << and ||= assignments, {||} blocks, etc. I don't parse those as well, because I don't program much Ruby. I'm sure if I did, it'd make a lot more 'intuitive' sense - ditto for you and Python's list comprehensions.
Re:Ruby is beautiful (but I'm moving to Python)
by nwmcsween on Wednesday December 01, 2010 @12:29AM
(#1956943)
<< and >> are rudimentary it's almost always exactly the same as unix dated from 1970's redirection. e.g: $ echo 'crap' >> somefile.txt. ||= reads as 'or equal', simple.
Re:Ruby is beautiful (but I'm moving to Python)
by anthonyb on Monday December 06, 2010 @12:31AM
(#1974063)
Yeah, I know what they do - eg. ||= being a Ruby idiom for 'set if this currently evaluates as false'. The point is that because I don't often program in Ruby, it's less readable (for me). Similarly, if you're not used to list comprehensions they'll seem opaque - but I use them all the time, and find them far more readable than equivalent expressions using map/filter.
That said, I do find the more "squiggly" languages (Perl, Ruby, C) to be less readable than the equivalent Scheme or Python, and I suspect that it's because there are fewer weird characters, so it's closer to English.
Also, this is a better version in Ruby:
…not sure what I was thinking before, it was late.