News for hackers. Stuff that matters.
Re:Why People Should Learn Python by K0nserv on Wednesday August 24, 2016 @10:27AM (#12352261)
I guess it's a personal style choice, the Python code is more performant(less iterations over the data set), but I like the ruby version better.
Re:Why People Should Learn Python by ezrast on Wednesday August 24, 2016 @08:59PM (#12356293)
It's only one iteration if you throw a .lazy in there:

products.lazy.select { |product| product.type == 'x' }.map(&:price).reduce(:+)