isinstance() considered harmful

Aahz Maruch aahz at panix.com
Fri Feb 1 19:01:31 CET 2002


In article <mailman.1011915337.20073.python-list at python.org>,
 <kosh at aesaeion.com> 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 pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
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