7 ms·
This has been up so many times. It's not happening, live with it. Python "lambdas" can do most things you need anyway.Normally I don't really find the need for
by globalrev 18y ago
This has been up so many times. It's not happening, live with it. Python "lambdas" can do most things you need anyway.Normally I don't really find the need for supercomplicated lambdas and you can do if-else in lambda s in Python with the ternary operator, see below:
#######
def throwaway_function(emp):
if emp.salary > developer.salary:
return fireEmployee(emp)
else:
return extendContract(emp)
employees.select(throwaway_function)
######
Python lambda:
filter(lambda emp: fireEmployee(emp) if emp.salary > developer.salary else extendContract(emp), employees)
Don't know what select does but it sounds like filter. So if that works as intended(is the ruby version both returning value and side-effecting?) or not I'm not sure but you probably could make it.