Skip to main content
Loading page…
Python Mastery
Chapter 9
Lesson 4 of 4
EAFP, Validation & Robust Code
Contents
Notes
Tutor
Concept
EAFP vs LBYL
Loading activity…
Previous
1 / 9
Continue
Contents
Notes
Discussion
Tutor
18 min
9 activities
0 of 9 done
In this lesson
1
EAFP vs LBYL
2
EAFP in File Processing
3
Input Validation at Boundaries
4
Never Swallow Errors — Log Them
5
EAFP vs LBYL — Choose the Right Style
6
Refactor a Silent Failure
7
Defensive Boundaries: The Golden Rule
8
Diagnose This Pattern
9
Exception Handling Decision Flow
Objectives
Learner can explain EAFP and LBYL and choose the right style for a given situation
Learner can validate function inputs and raise meaningful errors at the boundary
Learner can log an exception without swallowing it
Learner can identify code that swallows errors silently and refactor it to fail loudly
Chapter 9 · Errors & Exceptions
Reading Tracebacks
try / except / else / finally
Raising & Custom Exceptions
EAFP, Validation & Robust Code
Previous: Raising & Custom Exceptions
Next: Reading & Writing Files