is there any overheard with try/except statements?

John Salerno johnjsal at NOSPAMgmail.com
Wed Mar 8 20:17:43 EST 2006


John Salerno wrote:
> 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?
> 
> Thanks.

Thanks guys! I had a feeling exceptions were nothing like in C languages 
(i.e. a pain to deal with).  :)



More information about the Python-list mailing list