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 27B516DE0ACB for ; Tue, 28 Nov 2017 18:01:22 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.016 X-Spam-Level: X-Spam-Status: No, score=-0.016 tagged_above=-999 required=5 tests=[AWL=-0.016] 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 ZTkfzxDepUVv for ; Tue, 28 Nov 2017 18:01:21 -0800 (PST) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id 5B3B86DE014D for ; Tue, 28 Nov 2017 18:01:21 -0800 (PST) Received: from fifthhorseman.net (ool-6c3a0662.static.optonline.net [108.58.6.98]) by che.mayfirst.org (Postfix) with ESMTPSA id AB212F99A; Tue, 28 Nov 2017 21:01:19 -0500 (EST) Received: by fifthhorseman.net (Postfix, from userid 1000) id C39ED205CA; Tue, 28 Nov 2017 20:57:27 -0500 (EST) From: Daniel Kahn Gillmor To: Ruben Pollan , notmuch@notmuchmail.org Subject: Re: [PATCH] python: add bindings for notmuch_message_get_propert(y/ies) In-Reply-To: <20171128224611.10712-1-meskio@sindominio.net> References: <878tf5uvjm.fsf@fifthhorseman.net> <20171128224611.10712-1-meskio@sindominio.net> Date: Tue, 28 Nov 2017 20:57:24 -0500 Message-ID: <87k1y97sor.fsf@fifthhorseman.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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 02:01:22 -0000 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue 2017-11-28 23:46:11 +0100, Ruben Pollan wrote: > Message.get_property (prop) returns a string with the value of the proper= ty and > Message.get_properties (prop, exact=3DFalse) 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, =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. Also, does get_properties() work with prop=3DNone to fetch all properties? if so, maybe that should be the default? To be clear, I'd be fine with a response that disagrees with these suggestions (especially if it explains why) and then adopting this patch; i just want to make sure they've been considered before we lock in the API. Thanks for working on this, Meskio! --dkg --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEOCdgUepHf6PklTkyFJitxsGSMjcFAloeFAUACgkQFJitxsGS MjdsZA/9Hjl67UUVvThgebRoFnpgTaZYKn3nUiYCV1wYh4tQxPrJP9H2vBp/SHCp i2dDPCnhKAo/yQwX9QS0YhvAZD4ZkC8zwIXjSAa2+6Ap5N5ugdoBk4cMrikt4q7S 2SWKhp5ZK+LogNjze7QzJzz9ItFY/KZdFXhvlkeuV9lPMlM/H2FClYSE79J2kWQ4 FY4XWKLrb874HE6Aa+5n+usjdE6/E7qvK+0e+Xjl8eRSbha78LyeLbgYJYvcOB/z IyRfhe2eIPUmkdqpqKNa0uOQSeVTivkqrYf5yhgUSYAPzRTAPbKU+/ceHkYV7Wmo EMs8CB4O/bVz1N4fjgYwT53Gpep/p5Hm8y0NW8I6+i2ClovGQ2vGg1QNMIvwjY2m xsAfJx1cXTc3+vmKAAOypPRnW1BfUtsYTFe5ErqV+6wrTXFAPkcAjl7wqRqX7YxN SpfubY9z5vlL5rFuMvkbiYT9iAjDkBoK9GcBsGYRhtaKuCyoC1pDvX4PiBovBR+K hyMnU/dRF1rQEqAbTgmBSjCDL3XRVqD6TMNTnjk/l1fEhSTMVxoUVxoXcyY3UbSD K3uc6Gezf6O28sfEym4Yw6/kJyeK/PUdq0hVsJo3lwTrWZhbcmVZAOtErIwxDOKe IkirgVtoVTXjx8vukBXKir418ppshLGTpiMldK0xunlf9snZp1U= =MJdR -----END PGP SIGNATURE----- --=-=-=--