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 B65C16DE0F1C for ; Sun, 17 Feb 2019 03:20:14 -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] 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 DY3octf3zisu for ; Sun, 17 Feb 2019 03:20:13 -0800 (PST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 3BC046DE0F17 for ; Sun, 17 Feb 2019 03:20:13 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1gvKUS-0007s4-ED; Sun, 17 Feb 2019 06:20:08 -0500 Received: (nullmailer pid 28250 invoked by uid 1000); Sun, 17 Feb 2019 11:19:34 -0000 From: David Bremner To: VA , notmuch@notmuchmail.org Subject: Re: [PATCH] python: fix get_property error when property doesn't exist In-Reply-To: <18a072f6-01d8-8f88-95f1-b47b6595ecea@indigo.re> References: <877eejlj0i.fsf@tethera.net> <18a072f6-01d8-8f88-95f1-b47b6595ecea@indigo.re> Date: Sun, 17 Feb 2019 07:19:34 -0400 Message-ID: <871s46slvd.fsf@tethera.net> 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: Sun, 17 Feb 2019 11:20:14 -0000 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. d