mirror of
https://github.com/wassname/catalyst.git
synced 2026-10-29 13:00:42 +08:00
PERF: Remove in operator from inner loop.
Ask forgiveness via exception handling instead.
This commit is contained in:
1 parent
f8755a5602
commit
f33193069c
1 file changed
+4
-2
@@ -217,8 +217,10 @@ class AlgorithmSimulator(object):
|
||||
Update the universe with new event information.
|
||||
"""
|
||||
# Update our knowledge of this event's sid
|
||||
if event.sid in self.current_data:
|
||||
# rather than use if event.sid in ..., just trying
|
||||
# and handling the exception is significantly faster
|
||||
try:
|
||||
sid_data = self.current_data[event.sid]
|
||||
else:
|
||||
except KeyError:
|
||||
sid_data = self.current_data[event.sid] = SIDData()
|
||||
sid_data.__dict__.update(event.__dict__)
|
||||
Reference in new issue
Block a user