3 ms·
From the blog, it has the following piece of code: def outcome(hiring_procedure): allowable_candidates = [c for c in all_candidates if hiring_procedure(c)]
by static_typed 13y ago
From the blog, it has the following piece of code:
def outcome(hiring_procedure):
allowable_candidates = [c for c in all_candidates if hiring_procedure(c)]
candidate_values = [risk_profile(value(c)) for c in allowable_candidates]
return candidate_values.sum() / len(candidate_values)
What happens if we get to the return line, with an empty candidate_values? ZeroDivisionError ?
- yummyfajitas 13y agoThe short answer is, that code is a lie. It should actually have been the integral of risk_profile(value(c)) dP(c). But the python code is close enough to illustrate the point, and I've found people are far more likely to read and understand python code than equations.