Skip to content

Commit f4e8b7b

Browse files
committed
find_next_active_node: take min outside lsit comprehension
1 parent 2a87126 commit f4e8b7b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ciw/simulation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ def find_next_active_node(self):
171171
"""
172172
Returns the next active node:
173173
"""
174+
next_event_date = min([nd.next_event_date for nd in self.nodes])
174175
next_active_node_indices = [i for i, x in enumerate([
175-
nd.next_event_date for nd in self.nodes]) if x == min([
176-
nd.next_event_date for nd in self.nodes])]
176+
nd.next_event_date for nd in self.nodes]) if x == next_event_date]
177177
if len(next_active_node_indices) > 1:
178178
return self.nodes[random_choice(next_active_node_indices)]
179179
return self.nodes[next_active_node_indices[0]]

0 commit comments

Comments
 (0)