“In plain English, an assert statement says, “I assert that this condition holds true, and if not, there is a bug somewhere in the program.” Unlike exceptions, your code should not handle assert statements with try and except; if an assert fails, your program should crash. By failing fast like this, you shorten the time between the original cause of the bug and when you first notice the bug. This will reduce the amount of code you will have to check before finding the code that’s causing the bug. Assertions are for programmer errors, not user errors. For errors that can be recovered from (such as a file not being found or the user entering invalid data), raise an exception instead of detecting it with an assert statement.”
―
Automate the Boring Stuff with Python: Practical Programming for Total Beginners
Share this quote:
Friends Who Liked This Quote
To see what your friends thought of this quote, please sign up!
0 likes
All Members Who Liked This Quote
None yet!
This Quote Is From

3,103 ratings, average rating, 270 reviews
Browse By Tag
- love (100715)
- life (78920)
- inspirational (75370)
- humor (44123)
- philosophy (30721)
- inspirational-quotes (28622)
- god (26790)
- truth (24579)
- wisdom (24368)
- romance (24217)
- poetry (23083)
- life-lessons (22251)
- quotes (20547)
- death (20461)
- happiness (18893)
- hope (18398)
- faith (18269)
- inspiration (17196)
- spirituality (15589)
- relationships (15370)
- religion (15314)
- motivational (15225)
- life-quotes (15155)
- love-quotes (15023)
- writing (14882)
- success (14131)
- travel (13127)
- motivation (13065)
- time (12787)
- science (12013)