On Jul 23, 2007, at 8:56 PM, Paul Newton wrote:
>> Start coding in Python, where 'try' blocks are routine, since in
>> many cases it's faster to catch an exception than to test for a
>> condition.
> Yes but it doesn't *feel* right to be "trying" something rather than
> testing in advance ...
But slow apps feel right? ;-)
I know what you mean, but I've seen the performance differences. One
of my current apps has some low-level drawing routines (similar to
the GDI stuff) that are called by the Paint event handler. Paint
events can happen thousands of times a second, so the differences
between:
if hasattr(self, "drawObj"):
self.drawObj.redraw()
- and -
try:
self.drawObj.redraw()
except AttributeError:
pass
...is pretty hefty.
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.