From 31f1f8a99d10d09ba87fd04b04c4b1cd2d65fdee Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Tue, 6 Aug 2002 20:08:32 +0000 Subject: [PATCH] replaced try block with hasattr --- direct/src/showbase/DirectObject.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/direct/src/showbase/DirectObject.py b/direct/src/showbase/DirectObject.py index 1e84518ec5..1a00e4edda 100644 --- a/direct/src/showbase/DirectObject.py +++ b/direct/src/showbase/DirectObject.py @@ -22,9 +22,7 @@ class DirectObject: # an unused dictionary taking up space # - the speed hit of calling this function on calls to accept, # ignore, etc. is negligible, since they are not called often - try: - self.events - except: + if not hasattr(self, "events"): # list of events that this object is accepting # we use a dictionary to avoid linear searches self.events = {}