]> git.notmuchmail.org Git - notmuch/commitdiff
bindings/python: Implement Tags().__nonzero__()
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 2 Jun 2011 15:28:50 +0000 (17:28 +0200)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 2 Jun 2011 15:28:50 +0000 (17:28 +0200)
Analog to Threads.__nonzero__ this allows us to perform list() on a Threads() object and to repeatedly call "if Tags():" or "bool(Tags())" without implicitly invoking len(), thus exhausting our iterator.

While touching this code, I added a small micro-optimization to the Tag next() function. There is no need to explicitly check _is_valid, as _get implicitly does check for validness and returns None, if there is no more Tag to fetch. This avoids some roundtrips into the library when iterating through Tags.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>

No differences found