Re: [PATCH] python: add bindings for notmuch_message_get_propert(y/ies)

Subject: Re: [PATCH] python: add bindings for notmuch_message_get_propert(y/ies)

Date: Wed, 29 Nov 2017 09:02:09 +0100

To: Daniel Kahn Gillmor,


From: meskio

Quoting Daniel Kahn Gillmor (2017-11-29 02:57:24)
> On Tue 2017-11-28 23:46:11 +0100, Ruben Pollan wrote:
> > Message.get_property (prop) returns a string with the value of the property and
> > Message.get_properties (prop, exact=False) returns a list [(key, value)]
> This looks like a sensible approach to me.  I'd be curious to hear what
> others think of this.
> In considering the API design space here, it occurs to me that it might
> be more pythonic for get_properties to return a dict like:
>    { key: [ value, … ], key: [ value, … ] }
> Any reason you chose one over the other?  My python-fu is shallow, so
> please don't take my aesthetic guesswork as authoritative; but i'm
> imagining a user wanting to grab a bunch of properties and then easily
> access them by key, and the dict seems like the simple way to do that.

Yes, the dict is more pythonic. I thought about it, I went for the tuples it was 
simpler to implement (and use in my use case). But giving a second thought it 
makes more sense to do a dict.

> Also, does get_properties() work with prop=None to fetch all properties?
> if so, maybe that should be the default?

I didn't thought about that, but you are right, with prop="" you get the full 
list of properties of the message. Nice, let's put it as default value.

meskio |
 My contact info:
Nos vamos a Croatan.
signature.asc (application/pgp-signature)
notmuch mailing list