replaced try block with hasattr

This commit is contained in:
Darren Ranalli 2002-08-06 20:08:32 +00:00
parent c20b60222a
commit 31f1f8a99d

View File

@ -22,9 +22,7 @@ class DirectObject:
# an unused dictionary taking up space # an unused dictionary taking up space
# - the speed hit of calling this function on calls to accept, # - the speed hit of calling this function on calls to accept,
# ignore, etc. is negligible, since they are not called often # ignore, etc. is negligible, since they are not called often
try: if not hasattr(self, "events"):
self.events
except:
# list of events that this object is accepting # list of events that this object is accepting
# we use a dictionary to avoid linear searches # we use a dictionary to avoid linear searches
self.events = {} self.events = {}