Hacker News new | ask | show | jobs
by static_typed 4598 days 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 ?

1 comments

The 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.