Handling or Preventing Errors in Python: LBYL vs EAFP (Summary)
Now you know that Python has the look before you leap (LBYL) and easier to ask forgiveness than permission (EAFP) coding styles, which are general strategies to deal with errors and exceptional situations in your code. You’ve also learned what these coding styles are and how to use them in your code.
In this video course, you’ve learned:
- The basics of Python’s LBYL and EAFP coding styles
- The pros and cons of LBYL vs EAFP in Python
- The keys to deciding when to use either LBYL or EAFP
With this knowledge about Python’s LBYL and EAFP coding styles, you’re now able to decide which strategy to use when you’re dealing with errors and exceptional situations in your code.
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:00 Congratulations on completing, Handling or Preventing Errors in Python: LBYL vs EAFP. You now know so much more about error handling in Python. In this course, you’ve learned the importance of errors in error handling, writing code in an EAFP or LBYL style, the advantages and disadvantages of each style, as well as how to pick the right style for any given situation.
00:25 If you liked this course and want to dive deeper on Python errors and code styles, here’s some additional resources. Python’s Built-in Exceptions: A Walkthrough With Examples, How to Write Beautiful Python Code With PEP 8, and if you really want to go deep, you can follow the learning path, Write More Pythonic Code.
00:44 After working through this collection of courses, you’ll be an expert in writing idiomatic Python code.
00:51 Thank you so much for finishing the course. It really means a lot to me.
Become a Member to join the conversation.