I am quite puzzled, I am trying to remove task once they are not needed anymore but they are executed one more time.
class Updatable(object): def run(self, name): self.pTask = taskMgr.add(self.update, name) def delete(self): removed = taskMgr.remove(self.pTask) assert removed del self.pTask def update(self): try : next_node = self.current_iterator.next() if next_node is None : self.delete() # no more update!!!! except StopIteration: raise AssertionError # arg! still updating !!
many prints and the raise statement prooved me that :
1/ the delete method is called
2/ the taskMgr.remove returns True
3/ the update is called once after the delete
What am i doing wrong ?