Exception as the primary error handling mechanism?

Benjamin Kaplan benjamin.kaplan at case.edu
Fri Jan 1 11:02:28 EST 2010


On Fri, Jan 1, 2010 at 9:49 AM, Steven D'Aprano
<steve at remove-this-cybersource.com.au> wrote:
>
> Exceptions are *exceptional*, not "errors" or "unexpected". They are
> exceptional because they aren't the "normal" case, but that doesn't mean
> they are surprising or unexpected. Are you surprised that your "for x in
> range(1000)" loop comes to an end? Of course you are not -- it is
> completely expected, even though less than 1% of the iterations are the
> last loop. The end of the sequence is EXCEPTIONAL but not UNEXPECTED.
>

Sorry if my word choice was confusing- I was trying to point out that
in Python, you don't test errors for your typical conditions, but for
ones that you know still exist but don't plan on occurring often.



More information about the Python-list mailing list