Re: [PATCH 1/2] python: add bindings for notmuch_database_get_config{, _list}

Subject: Re: [PATCH 1/2] python: add bindings for notmuch_database_get_config{, _list}

Date: Mon, 26 Jun 2017 20:19:47 -0300

To: Lucas Hoffmann,


From: David Bremner

Lucas Hoffmann <> writes:

> I don't see a reason to have python programmers handle "manual
> iterators" or however you want to call the thing the C code does there.
> So I would like to keep *some* simplified interface as well.
> It is very easy to turn this into a generator.  But then I consider the
> name a mismatch.  If it is called "get_config_list" it should return a
> list.  I could add get_config_iterator or get_config_generator and turn
> get_config_list into a wrapper:

For starters I'd just create get_config_{iterator,generator}, which ever
is a more pythonic name. As you point out below, it's easy to turn that
into a list or a dictionary.
> The only problem one could see with this additional entry point is what
> you said in about the function
> get_all_named_queries (quote below), namely that the names of the python
> bindings diverge from the names of the C bindings.

It's not so much the names diverging that I worry about as the
functionality. The C library provides (effectively) a generator, so the
bindings should too.