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 066026DE107F for ; Mon, 18 Feb 2019 11:30:05 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.461 X-Spam-Level: X-Spam-Status: No, score=0.461 tagged_above=-999 required=5 tests=[AWL=-0.191, SPF_NEUTRAL=0.652] 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 gfx8mG0quNgA for ; Mon, 18 Feb 2019 11:30:03 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 564816DE107A for ; Mon, 18 Feb 2019 11:30:03 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 380E6100063; Mon, 18 Feb 2019 21:29:58 +0200 (EET) From: Tomi Ollila To: David Bremner , VA , notmuch@notmuchmail.org Subject: Re: [PATCH] python: fix get_property error when property doesn't exist In-Reply-To: <871s46slvd.fsf@tethera.net> References: <877eejlj0i.fsf@tethera.net> <18a072f6-01d8-8f88-95f1-b47b6595ecea@indigo.re> <871s46slvd.fsf@tethera.net> User-Agent: Notmuch/0.28+29~ga10f231 (https://notmuchmail.org) Emacs/25.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 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: Mon, 18 Feb 2019 19:30:05 -0000 On Sun, Feb 17 2019, David Bremner wrote: > VA writes: > >> Le 01/02/2019 =C3=A0 14:45, David Bremner a =C3=A9crit=C2=A0: >>> Should we be throwing an appropriate exception rather than returning >>> None? That seems more pythonic to me. In either case we should document >>> the error handling. >> >> What would it be? KeyError? >> Though, some standard Python methods like dict.get return None in case=20 >> the key doesn't exist. > > Vincent pointed out on IRC that this patch doesn't introduce returning > None here, but just fixes the code that tries to do it. So this patch is > an improvement on the status quo. indeed. +1 Tomi > > d > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch