Cost of exception handlers in Python
Posted
by Thilo
on Stack Overflow
See other posts from Stack Overflow
or by Thilo
Published on 2010-03-26T08:52:20Z
Indexed on
2010/03/26
9:13 UTC
Read the original article
Hit count: 439
In another question, the accepted answer suggested replacing a (very cheap) if statement in Python code with a try/except block to improve performance.
Coding style issues aside, and assuming that the exception is never triggered, how much difference does it make (performance-wise) to have an exception handler, versus not having one, versus having a compare-to-zero if-statement?
© Stack Overflow or respective owner