5 Exceptional events
This chapter covers
- What exceptions are
- Why they occur in programs
- How to handle exceptions
- How to raise an exception
- Creating custom exceptions
Developing software can lead you to think in a binary way—things are either on or off; they work or don’t work; something is either true or false. However, the real world is far from binary; it is a sea of variety. The software you create for yourself, and others, lives in that world.
The real world is not black or white; it is an infinitely variable field stretching between those two extremes. Computer systems that run software lose power and fail. The networks connecting systems are slow, intermittent, or unreliable. The storage systems on which software depends to save information ...
Get The Well-Grounded Python Developer now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.