Re: [PATCH 2/2] python: add convenience function to get named queries

Subject: Re: [PATCH 2/2] python: add convenience function to get named queries

Date: Sat, 10 Jun 2017 08:37:07 -0300

To: l-m-h@web.de, notmuch@notmuchmail.org

Cc: Lucas Hoffmann

From: David Bremner


l-m-h@web.de writes:

see above re: commit messages.

> ---
>  bindings/python/notmuch/database.py | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> +
> +    def get_all_named_queries(self):
> +        """Returns a dict of all named queries mapped to their search queries.
> +
> +        This function is a python extension and not in the underlying C API.
> +        """
> +        return {k[6:]: v for k, v in self.get_config_list('query.')}

I have somewhat mixed feelings about this. I don't really like the
python bindings diverging from the C library.  It's also not clear it's
worth supporting a new API entry (since e.g. if this goes in it also
needs a test) to save the python client one line of code. On the
positive side I can see there is arguably a missing abstraction on the
library side, as those particular config items are special.

Thread: