Represents a list of notmuch tags
This object provides an iterator over a list of notmuch tags (which are unicode instances).
Do note that the underlying library only provides a one-time iterator (it cannot reset the iterator to the start). Thus iterating over the function will “exhaust” the list of tags, and a subsequent iteration attempt will raise a NotInitializedError. Also note, that any function that uses iteration (nearly all) will also exhaust the tags. So both:
for tag in tags: print tag
as well as:
number_of_tags = len(tags)
and even a simple:
#str() iterates over all tags to construct a space separated list
print(str(tags))
will “exhaust” the Tags. If you need to re-iterate over a list of tags you will need to retrieve a new Tags object.
Parameters: |
|
---|---|
Todo : | Make the iterator optionally work more than once by cache the tags in the Python object(?) |
Warning
__len__() was removed in version 0.6 as it exhausted the iterator and broke list(Tags()). Use len(list(msgs))() instead if you need to know the number of tags.