Optimize FSMBase by using generators for predicate logic

This commit is contained in:
Kristóf Tóth 2018-07-10 15:40:10 +02:00
parent f78f01d6e1
commit 0e8f529726

View File

@ -52,10 +52,10 @@ class FSMBase(Machine, CallbackMixin):
]
def step(self, trigger):
predicate_results = [
predicate_results = (
predicate()
for predicate in self.trigger_predicates[trigger]
]
)
# TODO: think about what could we do when this prevents triggering
if all(predicate_results):