3 ms·
1) Multi-line lambdas (no equivalent in python afaik): collection.map do |i| blah = something(i.something) blah.something_else end 2) Easily chain
by aianus 9y ago
1) Multi-line lambdas (no equivalent in python afaik):
collection.map do |i|
blah = something(i.something)
blah.something_else
end
2) Easily chainable object methods instead of weird global functions:
a.length
collection.map { |x| x^2 }
vs
len(a)
map(lambda x: x^2, collection)
3) Closing braces instead of whitespace make it a lot easier to judge indentation level
- pvg 9y agoThe 'equivalent' for that sort of thing in Python these days is comprehensions. The other stuff is pretty subjective. There is a blurb in the FAQ about things like 'len' and it makes the argument it's more readable.