From 0e8f5297267f935a47062f9a5f7ccd4a54ccb668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Tue, 10 Jul 2018 15:40:10 +0200 Subject: [PATCH] Optimize FSMBase by using generators for predicate logic --- lib/tfw/fsm_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tfw/fsm_base.py b/lib/tfw/fsm_base.py index b7f270d..28b5ef6 100644 --- a/lib/tfw/fsm_base.py +++ b/lib/tfw/fsm_base.py @@ -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):