if x % i == 0: if (x/i) in dp: return dp[x/i] return ishumble(x / i) #i don't believe this ever get's called
[...] because we are guaranteed that
if x % i == 0
, then(x/i)
is indp
! So I believe that thereturn ishumble(x / i)
line is actually never called.
If you believe that some condition is always fulfilled, but you don't want to or are not able to prove it, you could let Python verify it for you by using an assertion:
if x % i == 0:
assert x/i in dp, "x/i is not in dp: {}/{}".format(x, i)
return dp[x/i]
This way, you don't have dead code, but will still be notified when your assumptions should turn out wrong.