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
# - 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 = {}