Handling or Preventing Errors in Python: LBYL vs EAFP - Real Python
Briefly

"Dealing with errors and exceptional situations is a common requirement in programming. You can either prevent errors before they happen or handle errors after they've happened."
"In general, you'll have two coding styles matching these strategies: look before you leap (LBYL), and easier to ask forgiveness than permission (EAFP), respectively."
"By learning about Python's LBYL and EAFP coding styles, you'll be able to decide which strategy and coding style to use when you're dealing with errors in your code."
"Understand the pros and cons of LBYL vs EAFP to ensure effective error handling in your Python programs."
Read at Realpython
[
|
]