micro-optimization

Cost of exception handlers in Python

Cost of exception handlers in Python Question: 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 …

Total answers: 5