Exception as the primary error handling mechanism?
pengyu.ut at gmail.com
Fri Jan 1 05:47:49 CET 2010
I observe that python library primarily use exception for error
handling rather than use error code.
In the article API Design Matters by Michi Henning
Communications of the ACM
Vol. 52 No. 5, Pages 46-56
It says "Another popular design flaw—namely, throwing exceptions for
expected outcomes—also causes inefficiencies because catching and
handling exceptions is almost always slower than testing a return
My observation is contradicted to the above statement by Henning. If
my observation is wrong, please just ignore my question below.
Otherwise, could some python expert explain to me why exception is
widely used for error handling in python? Is it because the efficiency
is not the primary goal of python?
More information about the Python-list