Will Python exceptions be documented?
Peter Hansen
peter at engcorp.com
Mon Jul 7 08:00:08 EDT 2003
Vegard Bakke wrote:
>
> All know that asin(2) is wrong, but how do I know that ValueError is
> the exception I should catch, and how do I know that is the only one?
> (Sorry, try it is the wrong answere here.)
See http://www.python.org/doc/current/lib/module-math.html where
on this specific case, for example, it says
Note: Specific exceptions raised in assorted error cases (and even
whether some arguments are considered to be exceptional at all) are
not defined in any useful cross-platform or cross-release way. For
example, whether math.log(0) returns -Inf or raises ValueError or
OverflowError is both platform- and release-dependent, and in cases where
math.log(0) raises an OverflowError, math.log(0L) often raises a ValueError.
-Peter
More information about the Python-list
mailing list