is a strategy most programming languages
(including Python 2.7) use to avoid
unnecessary work. For example, say we had a conditional like this:
if it_is_friday and it_is_raining:
print "board games at my place!"
Let's say it_is_friday is false.
Because Python 2.7 short-circuits evaluation,
it wouldn't bother checking the value
of it_is_raining—it knows that either way
the condition is false and we
won't print the invitation to board game night.
We can use this to our advantage. For example, say we have a check
What happens if 'Becky' isn't in
We'll get a KeyError
when we run friends['Becky'].
Instead, we could first confirm that Becky and I are still on good
if 'Becky' in friends and friends['Becky'].is_free_this_friday():
This way, if 'Becky'isn't
in friends, Python will ignore the rest of the conditional and
This is all hypothetical, of course. It's not like things with Becky
are weird or anything. We're totally cool. She's still in my
friends dictionary for sure and I hope I'm still
in hers and Becky if you're reading this I just want you to know
you're still in my friends dictionary.
Actually, we don't support password-based login. Never have. Just the OAuth methods above. Why?
It's easy and quick. No "reset password" flow. No password to forget.
It lets us avoid storing passwords that hackers could access and use to try to log into our users' email or bank accounts.
It makes it harder for one person to share a paid Interview Cake account with multiple people.
“For someone without formal training in software, this site was immensely helpful in teaching me how to approach challenging problems. Got the first job I interviewed for, off to Silicon Valley I go!