Tags – Notmuch tags¶
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_p (
ctypes.c_void_p) – A pointer to an underlying notmuch_tags_t structure. These are not publically exposed, so a user will almost never instantiate a
Tagsobject herself. They are usually handed back as a result, e.g. in
Database.get_all_tags(). tags_p must be valid, we will raise an
NullPointerErrorif it is None.
- parent – The parent object (ie
Messagethese tags are derived from, and saves a reference to it, so we can automatically delete the db object once all derived objects are dead.
Make the iterator optionally work more than once by cache the tags in the Python object(?)
__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.
- tags_p (