March 9, 2009
4:39 p.m.
On Mon, Mar 9, 2009 at 6:04 AM, tav <tav@espians.com> wrote:
I've come up with a way to do Ruby-style blocks in what I feel to be a Pythonic way:
using employees.select do (employee): if employee.salary > developer.salary: fireEmployee(employee) else: extendContract(employee)
Sounds like you might as well write a decorator named @using: @using(employees.select) def _(employee): if employee.salary > developer.salary: fireEmployee(employee) else: extendContract(employee) -- --Guido van Rossum (home page: http://www.python.org/~guido/)