2 ms·
Python uses exceptions more casually than many other languages. It follows EAFP. Exceptions don't have to be very exceptional. Doing it like that would be out
by duckerude 8y ago
Python uses exceptions more casually than many other languages. It follows EAFP. Exceptions don't have to be very exceptional.
Doing it like that would be out of place in many languages with different sensibilities, but it fits ok in Python.
It also helps that you rarely deal with StopIteration exceptions directly or even have to remember they're used under the hood.