Anton Khirnov <anton@khirnov.net> writes: > def __init__(self, parent, iter_p, > - *, fn_destroy, fn_valid, fn_get, fn_next): > + *, fn_destroy, fn_valid, fn_get, fn_next, > + fn_status = None): > + # exactly one of those must be provided > + assert(bool(fn_valid) != bool(fn_status)) > + This might be a bit too clever, it definitely took me a minute to decode. > + def _check_status(self): > + if self._fn_valid: > + if not self._fn_valid(self._iter_p): > + raise StopIteration I think this needs a bit of commentary. I suppose this branch is only run for iterators without notmuch_*_status function, but it isn't clear. > + else: > + status = self._fn_status(self._iter_p) > + if status == capi.lib.NOTMUCH_STATUS_ITERATOR_EXHAUSTED: > + raise StopIteration > + elif status > 0: the rest of the bindings seem to prefer status != capi.lib.NOTMUCH_STATUS_SUCCESS: _______________________________________________ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-leave@notmuchmail.org