Monday, March 09, 2009

ruby->python




Ruby-style Blocks in Python

Yes, blocks in Ruby are very sexy, one of the nicest parts about Ruby.

Compare:

Ruby:

employees.select {|e| e.salary > developer.salary}


Python:

employees.select(lambda e: e.salary > developer.salary)