slow try statements in python?

Erik Max Francis max at alcyone.com
Mon Feb 17 17:20:30 EST 2003


Mark Higgins wrote:

> I've seen quite a few examples of python code where try statements are
> used to control the flow of a program... seems reasonable, but with my
> background in C++ I'm always concerned that try statements are slow.
> 
> Is this a concern in python?

No, since they're already de facto used for flow control in certain
circumstances.

Besides, even in C++, the idea is that the _throwing_ of an exception
might be expensive, but the defensive handling of one with a try...catch
clause should be very cheap.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Scars are like memories.  We do not have them removed.
\__/ Chmeee
    ZOE / http://www.alcyone.com/pyos/zoe/
 A simple Python OpenGL rendering engine.




More information about the Python-list mailing list