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

David Bremner david at tethera.net
Mon Jun 26 16:19:47 PDT 2017


Lucas Hoffmann <l-m-h at web.de> 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 id:87wp8kcbvg.fsf at tethera.net 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.

d



More information about the notmuch mailing list