is there any overheard with try/except statements?

John Salerno johnjsal at
Thu Mar 9 01:11:12 CET 2006

One of the things I learned with C# is that it's always better to handle 
any errors that might occur within the codes itself (i.e. using if 
statements, etc. to catch potential out of range indexing) rather than 
use too many try/catch statements, because there is some overhead every 
time the program encounters the try.

Is this the case at all with Python, in terms of extra work or slower 
speed? Or is try/except implemented differently in Python than it is in 
other languages, so that it runs just like any other code?


More information about the Python-list mailing list