Commits

Ronny Pfannschmidt committed cd0c3ec

code simplifications

Comments (0)

Files changed (2)

whenever/__init__.py

         self.statements = statements
         items = statements.keys()
         self.todo = {}
-        for i in range(len(items)):
-            self.todo[items[i]] = 1
+        for item in items:
+            self.todo[item] = 1
 
     
     def has_work(self):
-        items = self.todo.keys()
-        for i in range(len(items)):
-            if self.todo[items[i]]:
+        for item in self.todo:
+            if self.todo[item]:
                 return True
         return False
 
             self.push(i)
 
     def handle_compare(self, node):
-        b = self.pop(W_Int)
+        b = self.pop(W_Int).intval
         comp = self.pop(W_Compare)
-        a = self.pop(W_Int)
-
-        op = comp.op
-        an = a.intval
-        bn = b.intval
-        result = op(an, bn)
+        a = self.pop(W_Int).intval
+        result = comp.op(a, b)
         self.push(W_Bool(bool(result)))
 
     def handle_statement(self, node):