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 28C056DE0EF3 for ; Wed, 6 Feb 2019 11:24:58 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -2.301 X-Spam-Level: X-Spam-Status: No, score=-2.301 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3, 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 ce6Hl2FOrXhG for ; Wed, 6 Feb 2019 11:24:56 -0800 (PST) Received: from smtp-sh.infomaniak.ch (smtp-sh.infomaniak.ch [128.65.195.4]) by arlo.cworth.org (Postfix) with ESMTPS id 92E496DE0EF2 for ; Wed, 6 Feb 2019 11:24:56 -0800 (PST) Received: from smtp6.infomaniak.ch (smtp6.infomaniak.ch [83.166.132.19]) by smtp-sh.infomaniak.ch (8.14.5/8.14.5) with ESMTP id x16JOpkQ003315 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 6 Feb 2019 20:24:51 +0100 Received: from [IPv6:2a01:e35:8be3:1490:22cf:30ff:fe9a:43cf] ([IPv6:2a01:e35:8be3:1490:22cf:30ff:fe9a:43cf]) (authenticated bits=0) by smtp6.infomaniak.ch (8.14.5/8.14.5) with ESMTP id x16JOnkY024765 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 6 Feb 2019 20:24:50 +0100 Subject: Re: [PATCH] python: fix get_property error when property doesn't exist To: David Bremner , notmuch@notmuchmail.org References: <877eejlj0i.fsf@tethera.net> From: VA Message-ID: <18a072f6-01d8-8f88-95f1-b47b6595ecea@indigo.re> Date: Wed, 6 Feb 2019 20:24:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <877eejlj0i.fsf@tethera.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Antivirus: Dr.Web (R) for Unix mail servers drweb plugin ver.6.0.2.8 X-Antivirus-Code: 0x100000 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: Wed, 06 Feb 2019 19:24:58 -0000 Le 01/02/2019 à 14:45, David Bremner a écrit : > 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 the key doesn't exist.