From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id DB74F6DE0ACB for ; Wed, 29 Nov 2017 00:02:23 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.006 X-Spam-Level: X-Spam-Status: No, score=-0.006 tagged_above=-999 required=5 tests=[AWL=0.005, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ewvyrGTXITFG for ; Wed, 29 Nov 2017 00:02:23 -0800 (PST) Received: from eternauta.sindominio.net (eternauta.sindominio.net [80.81.122.47]) by arlo.cworth.org (Postfix) with ESMTPS id 72E086DE014D for ; Wed, 29 Nov 2017 00:02:22 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by lesnaus.sindominio.net (Postfix) with ESMTP id 0EEDE404F04; Wed, 29 Nov 2017 09:02:18 +0100 (CET) Received: from eternauta.sindominio.net ([127.0.0.1]) by localhost (lesnaus.sindominio.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id to_s6WLUvZ8H; Wed, 29 Nov 2017 09:02:15 +0100 (CET) Received: from localhost (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lesnaus.sindominio.net (Postfix) with ESMTPSA id 33412402D97; Wed, 29 Nov 2017 09:02:13 +0100 (CET) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha512"; boundary="===============0393867918795769306==" MIME-Version: 1.0 Content-Disposition: inline From: meskio To: Daniel Kahn Gillmor , notmuch@notmuchmail.org References: <878tf5uvjm.fsf@fifthhorseman.net> <20171128224611.10712-1-meskio@sindominio.net> <87k1y97sor.fsf@fifthhorseman.net> In-Reply-To: <87k1y97sor.fsf@fifthhorseman.net> Message-ID: <151194252933.14333.11265370454778979590@localhost> Subject: Re: [PATCH] python: add bindings for notmuch_message_get_propert(y/ies) Date: Wed, 29 Nov 2017 09:02:09 +0100 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 08:02:24 -0000 --===============0393867918795769306== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 prop= erty and > > Message.get_properties (prop, exact=3DFalse) returns a list [(key, valu= e)] > = > 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, =E2=80=A6 ], key: [ value, =E2=80=A6 ] } > = > 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 i= t 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=3DNone to fetch all properties? > if so, maybe that should be the default? I didn't thought about that, but you are right, with prop=3D"" you get the = full = list of properties of the message. Nice, let's put it as default value. -- = meskio | http://meskio.net/ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D- My contact info: http://meskio.net/crypto.txt -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D- Nos vamos a Croatan. --===============0393867918795769306== MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Description: signature Content-Type: application/pgp-signature; name="signature.asc"; charset="us-ascii" -----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----- --===============0393867918795769306==--