On Wed, Sep 23, 2009 at 5:49 PM, Michael Hanselmann <[email protected]> wrote: > 2009/9/23 Guido Trotter <[email protected]>: >> On Wed, Sep 23, 2009 at 5:07 PM, Michael Hanselmann <[email protected]> >> wrote: >> Interdiff: (but I think the new _HandleReply looks so ugly): > > Here's a nicer-looking try: >
Not sure it looks nicer.. functions that return in multiple places are so non-nice! (except for the if not bla: return ) > def _HandleReply(self, up): > salt = up.salt > > if salt not in self._answers: > self._answers[salt] = up.server_reply > return False > > if up.server_reply.serial > self._answers[salt].serial: > old_answer = self._answers[salt] > self._answers[salt] = up.server_reply > > if up.server_reply.answer != old_answer.answer: > return False > > self._LogFilter(salt, up.server_reply, old_answer) > return True > > self._LogFilter(salt, up.server_reply, self._answers[salt]) > return True > > Please also add some comments on what the code actually does. > Doesn't the docstring say that? Guido
