[PATCH] python: default op_keylist_start parameters.

Tobias Mueller muelli at cryptobitch.de
Mon Dec 5 13:46:19 CET 2016


Hi.

On Mon, Dec 05, 2016 at 12:55:50PM +0100, Justus Winter wrote:
> Interesting, I didn't know that.  Is SWIG using C++ under the hood, or
> are they parsing this and changing the prologue of the generated wrapper
> function?
No idea.  I can try to find out if you want me to.

> I'm not sure whether we want to do this or not.  Currently, we provide a
> very faithful "C-like API", and a idiomatic Python API on top.
I cannot make much sense of the term "faithful", but I think that it does
not exclude making the "C-like API" more usable.
I think the C-like API has already been made significantly easier to use, by, 
e.g. raising Python exceptions, allowing buffer- or file-like objects instead 
of Data objects, or providing lists instead of making the user call next().
So my feeling is that providing sensible default values goes in the same 
direction.

Other instances I have in mind are making Data.seek()'s "whence" default to
os.SEEK_SET like BufferIO and StringIO do or defaulting "pubkey" and "seckey"
parameters of op_genkey to NULL, because you currently have to do it when
you want to generate openpgp keys. These also requires to change the "C-API"
and I hope this is in the scope of the Python bindings.

> Thoughts?
I'm thinking that it's one additional line which increases the usability of the
API.  I appreciate that every line of code costs maintenance in the long run. My
feeling is that it's a reasonable price to pay for making the API a bit more
discoverable.  Of course, my judgement is not worth much here; if only because 
it's likely that it won't be me who has to pay that price ;-)

Cheers,
  Tobi



More information about the Gnupg-devel mailing list