Browse Source

replaced try block with hasattr

Darren Ranalli 23 years ago
parent
commit
31f1f8a99d
1 changed files with 1 additions and 3 deletions
  1. 1 3
      direct/src/showbase/DirectObject.py

+ 1 - 3
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 = {}