isinstance() considered harmful

Aahz Maruch aahz at
Fri Feb 1 13:01:31 EST 2002

In article <mailman.1011915337.20073.python-list at>,
 <kosh at> wrote:
>Well try except is slower then if else and rendering pages to the screen
>does have a time limit to it so speed is a pretty importance factor. 

Short version of Alex's post: try/except is guaranteed faster than
if/else if an exception is *not* raised.  If you expect that the try
clause will almost always not raise an exception (or if speed is
non-critical when an exception results), try/except is better for speed.
                      --- Aahz  <*>  (Copyright 2002 by aahz at

Hugs and backrubs -- I break Rule 6       
Androgynous poly kinky vanilla queer het Pythonista   

"The more you drive, the less intelligent you are."  --_Repo Man_

More information about the Python-list mailing list