diff options
author | Walther Neuper <neuper@neuper.(none)> | 2009-12-12 12:52:10 (GMT) |
---|---|---|
committer | Walther Neuper <neuper@neuper.(none)> | 2009-12-12 12:52:10 (GMT) |
commit | 3d6c4632aa33fddf823b2592e9dc8fca5f06abb4 (patch) | |
tree | a76132c8292c20537fc98ee3111927b61d0e4720 | |
parent | 5b909158c3d2631429f2e4ed5ff5a253023ec7e0 (diff) |
_try_ instead of _if_ for pop()
-rw-r--r-- | ReckonPrimer.activity/learner.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ReckonPrimer.activity/learner.py b/ReckonPrimer.activity/learner.py index 6ca42bb..15ce440 100644 --- a/ReckonPrimer.activity/learner.py +++ b/ReckonPrimer.activity/learner.py @@ -39,12 +39,12 @@ class Learner: #print('in Session.notify, digit-done: _input=', self._input) (lino, pos, dig, proterr, protok, li) = self._curr_in self._display.create_entryline((lino, -1, dig, proterr, protok, li)) - if len(self._input) > 0: + try: # _input.pop() self._curr_in = self._input.pop() self._display.create_entryline(self._curr_in) - else: # start new calc + except IndexError: # start new calc self._display.show_progress() - if len(self._calcs) > 0: + try: # get_next_calc _calc = (self._calcs).pop() print('in Session.notify: calc=', _calc) _lines, self._input = self._ex.format(_calc) @@ -52,5 +52,5 @@ class Learner: self._curr_in = self._input.pop() #need _curr_in in notify self._display.create_entryline(self._curr_in) # create_entryline sets the callback from gtk to Display - else: + except IndexError: self._display.finish_calc() |