4 ms·
For those that don't know (I didn't): EAFP - Easier to ask for forgiveness than permission LBYL - Look before you leap They are opposite strategies, P
by uep 7y ago
For those that don't know (I didn't):
EAFP - Easier to ask for forgiveness than permission
LBYL - Look before you leap
They are opposite strategies, Python's preferred strategy is to do the first, just try the operation and throw an exception if it doesn't work. The second is to check a pre-condition before attempting an operation.
I've always known the second as exhibiting TOCTOU, otherwise known as a time-of-check vs time-of-use race condition.