What does "EAFP" mean?
Model answer
"Easier to ask forgiveness than permission": try the operation and handle the exception, rather than checking conditions first ("look before you leap"). For example, try to read a key and handle KeyError. It is idiomatic in Python and avoids race conditions in some cases.
Learn this topic
Handling Errors in Python: try, except, finally and raise in the course Python for Beginners: Learn to Code with Real Projects.
Sign in to add your own answer.