unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: meskio <meskio@sindominio.net>
To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH] python: add bindings for notmuch_message_get_propert(y/ies)
Date: Wed, 29 Nov 2017 09:02:09 +0100	[thread overview]
Message-ID: <151194252933.14333.11265370454778979590@localhost> (raw)
In-Reply-To: <87k1y97sor.fsf@fifthhorseman.net>

[-- Attachment #1: Type: text/plain, Size: 1544 bytes --]

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 | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 My contact info: http://meskio.net/crypto.txt
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEs7M6f/ZpXzXMAQR+Urj1rJei2oYFAloeaXYACgkQUrj1rJei
2oaaCg//cB1YJGzuaPDOUrs7G3ZrdQ5hm9BFgPZBK8WFd9i55MrUfvffx1q3qOqZ
3a/qi1YUl+SCOJmtGNdrem/+KnHvIDQKS336K07hukEbPDMD/OLdmB7WJy4geBwi
FAF1TIX1P1voaie+yEeqTquRk2NqoczAQ3DNyW7AIjhulBI+Ris0AdnN8yXm/MB7
lZ0/WtLOJz6l5TaLkKICMgsk6FzibxkfxvDcA/zGYu4Rl9PKOjnB+K0IwPTRxofF
5S5FIbp5BVgb5ty1/zXcsZjuzRkehnr3zjDppmPd89EFLiGfN/NXTh0KlK0X7tKG
CgG8sEkoV0AxPHRWyMrVyF0WRJrsJcbtJ3MZkJHhSOSUfN5R6y5JyR4g2/YoZE2j
qi2wFjZiLut+BsJJ8glju97SpsdXy+0C8mSixYTvlCP31REngES4rnuJnVilBIPG
Sf2A00OvVvir8DZvxYJieJOklQxjeQLO7F0NOktuBnKFrNmjb+RpapwmODHVM80s
N45mECSjJT6ar9x+MEpUIWoBt7U+HH/A0+rwA7DuPrxR01ohv1U0rgxll1ckfk/K
Kpk+ZhJGC/rFi6pvffau/VTlu9ZFiESfFhYt7NtZkCBtdNp1XoU9SAqtt8CQWI/z
o5paezmIXqBBkWJ1hU9AKLJO+ADvXAvM2FHqkppx1l1nZFygUQw=
=GAXj
-----END PGP SIGNATURE-----

  reply	other threads:[~2017-11-29  8:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 22:29 [PATCH] python: add bindings for notmuch_message_get_property Ruben Pollan
2017-11-15 22:48 ` meskio
2017-11-17  9:03 ` Daniel Kahn Gillmor
2017-11-28 22:46   ` [PATCH] python: add bindings for notmuch_message_get_propert(y/ies) Ruben Pollan
2017-11-28 22:51     ` meskio
2017-11-29  1:57     ` Daniel Kahn Gillmor
2017-11-29  8:02       ` meskio [this message]
2017-11-29  8:03         ` Ruben Pollan
2017-12-23 15:59           ` David Bremner
2018-04-27 19:12             ` meskio
2018-04-27 19:15               ` Ruben Pollan
2018-05-01 13:06                 ` David Bremner
2018-05-01 15:24                   ` meskio
2018-05-01 15:28                     ` Ruben Pollan
2018-05-02  0:08                       ` David Bremner
2018-05-02 17:00                         ` meskio
2018-05-02 17:01                           ` Ruben Pollan
2018-05-02 23:50                             ` David Bremner
2017-11-29 21:40       ` Floris Bruynooghe
2017-11-30 13:44         ` David Bremner
2017-11-30 14:19           ` Daniel Kahn Gillmor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=151194252933.14333.11265370454778979590@localhost \
    --to=meskio@sindominio.net \
    --cc=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).