Deutsch English Français Italiano |
<mailman.102.1710591185.3452.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail From: Roel Schroeven <roel@roelschroeven.net> Newsgroups: comp.lang.python Subject: Re: Configuring an object via a dictionary Date: Sat, 16 Mar 2024 13:12:58 +0100 Lines: 20 Message-ID: <mailman.102.1710591185.3452.python-list@python.org> References: <b169e599-e81f-45ce-8e2a-7027b59a4627@tompassin.net> <60E92E67-1412-4DE6-B330-495343107474@barrys-emacs.org> <146a44f2-eead-49dc-a57c-f2abe9d1516d@roelschroeven.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de WYoKhoF9RMrFFxwev3q9jAhYnpX2TRfrHww6ZnBnkGlA== Cancel-Lock: sha1:/EoSXaEPqbTDCyk7pQAG4Tv1AgM= sha256:cC13YvjxsNtunC5YPHX0FR8jn2/fHh1ScJHVkCTQgLM= Return-Path: <roel@roelschroeven.net> X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org Authentication-Results: mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=roelschroeven.net header.i=@roelschroeven.net header.b=UhkwVKxp; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'this:': 0.03; 'mar': 0.07; 'cases.': 0.09; 'fails': 0.09; 'values.': 0.09; '>': 0.14; 'barry': 0.16; 'hand,': 0.16; 'idiom': 0.16; 'odd': 0.16; 'paper,': 0.16; 'planet': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:64.147': 0.16; 'received:64.147.123': 0.16; 'received:internal': 0.16; 'received:messagingengine.com': 0.16; 'schreef': 0.16; 'wrote:': 0.16; 'problem': 0.16; 'to:addr:python-list': 0.20; "i've": 0.22; 'problem,': 0.22; 'code': 0.23; "wasn't": 0.26; 'bit': 0.27; 'email addr:python.org>': 0.28; 'header:User-Agent:1': 0.30; 'whole': 0.30; "doesn't": 0.32; '"this': 0.32; 'concerned': 0.32; 'gotten': 0.32; 'python-list': 0.32; 'but': 0.32; 'skip:" 20': 0.34; 'header:In-Reply-To:1': 0.34; 'fix': 0.36; 'cases': 0.36; 'people': 0.36; 'using': 0.37; "it's": 0.37; 'use': 0.39; 'paper': 0.62; 'time.': 0.66; 'received:64': 0.67; 'movement': 0.69; 'solutions': 0.70; 'pieces': 0.70; 'too.': 0.70; 'living': 0.71; 'production': 0.71; 'email name:<python-list': 0.84; 'adams': 0.91; 'largely': 0.91; 'green': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= roelschroeven.net; h=cc:content-type:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1710591179; x= 1710677579; bh=f9fdjbHukel0IR57zYhvIse7TFjPy/cqJGGLH8i1Qno=; b=U hkwVKxpxLvUWPEAUAgtzGGUADvBuUr4Syadyc0aPbdqhuxZiXMxEYjZqle8WFGyM bf+Ig3bI9XrLeddIR1vMGF9yqYfgCWSEy7iF+v+k5W5Y15Ev7Q5AWkoJoQ4CBCJp cT3IPa8AOF/dabId6wG+oECh0CqIw9PiJZQ8ptflQVvtMQXJ6YXgCPdrU1qcxvwS RqAFVRQvVNk3XYDiuif60mm0OGvZCzPLJdXBwrzGJzMd6d9r/i1SGaG+puVB/rR8 8gfFfyuBcjEJcw1evse6Ubiix+E+bfDK5SDf0OdzmMByt3kfGdqkQwSpVHmxyf1c rG4SNgpjZNuDg1u639ASA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1710591179; x=1710677579; bh=f9fdjbHukel0IR57zYhvIse7TFjP y/cqJGGLH8i1Qno=; b=pkXj2Z1aL86pRq2HA9QXii1Ve0Rfh6za/vd+Ao0jgkhy FBlaMzj15k6hPyS2p3C5uk586fhT6XpbS+qIwwj7QG1NQukWhYzx5n2Eev2ZstB7 h55YKaFAGfxS7TNdiWGsgl9byCSb3m6vTAPi0ZEIrj5JmeuK3v8yAgphc0xdXFu9 uO9A1ccGGxYrySnOZch3cx2qMuFlhiY33+h9IIWAaGh+y85h7zznrudKpLO07u7d 4FgRqtAnagCVeQgXvB1UB0Oe75CO01f6IYH+hSEIWz+T2QgQ6IOyh8A7tA4v2d3u zSpVqxA9tHeNh1W/0Kfy+ZUv0joAQZk1rnGdiB0QKw== X-ME-Sender: <xms:y4z1ZdC0ROYAA_40F-t3CIXPPoy570ztcx2BrDp5wPAtmc4coJ5abw> <xme:y4z1Zbj4aR36INZnaUSCt-6NAOFvc4muaVmVMngfSueLhUZw_KOmvWX6OuiWm4OKc bdcogGEZxM5> X-ME-Received: <xmr:y4z1ZYmOlIxfqkkqtaISef5SGbKTVxzjnBD9wngp_82XUqADpT8ZGzaiysk8Qq7BNacubAbPkWzOceKqrU3K622X5rY_Z-A> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrkedvgddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurheptgfkffggfgfuvfhfhfgjsegrtderre dtvdejnecuhfhrohhmpeftohgvlhcuufgthhhrohgvvhgvnhcuoehrohgvlhesrhhovghl shgthhhrohgvvhgvnhdrnhgvtheqnecuggftrfgrthhtvghrnhepvdefffdvueduudekvd dvfeeutdehvdelfeelkeegkeefteehieetfffhffdugeegnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhovghlsehrohgvlhhstghhrhhovg hvvghnrdhnvght X-ME-Proxy: <xmx:y4z1ZXwyf8xelBL28qqfyg0eAzGtKFPq1HxWa33ptUeV5m-DDRotTA> <xmx:y4z1ZSSrF6hGwZ9yn6XG_SYnxDNKGljrWPPTnw1IErLx2CsdUVNIig> <xmx:y4z1ZabS7FN_7N8vVfnbR8xN5LnNg6I4R9c4u8ujErUXIAjTr4vNAg> <xmx:y4z1ZTRmvBgXnpr-ryE2p8vkLzXH6oze6Ubovrb79u_ldi4EGQd09A> <xmx:y4z1Zdd4VzMmUmJKS4vcA5PbXo-UZOGY585eBgwOFScEiKEElmE66vTsHEQ> Feedback-ID: i8e5b41ae:Fastmail User-Agent: Mozilla Thunderbird Content-Language: en-GB In-Reply-To: <60E92E67-1412-4DE6-B330-495343107474@barrys-emacs.org> X-Content-Filtered-By: Mailman/MimeDel 2.1.39 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: General discussion list for the Python programming language <python-list.python.org> List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> List-Archive: <https://mail.python.org/pipermail/python-list/> List-Post: <mailto:python-list@python.org> List-Help: <mailto:python-list-request@python.org?subject=help> List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> X-Mailman-Original-Message-ID: <146a44f2-eead-49dc-a57c-f2abe9d1516d@roelschroeven.net> X-Mailman-Original-References: <b169e599-e81f-45ce-8e2a-7027b59a4627@tompassin.net> <60E92E67-1412-4DE6-B330-495343107474@barrys-emacs.org> Bytes: 6978 Barry via Python-list schreef op 16/03/2024 om 9:15: > > > On 15 Mar 2024, at 19:51, Thomas Passin via Python-list <python-list@python.org> wrote: > > > > I've always like writing using the "or" form and have never gotten bit > > I, on the other hand, had to fix a production problem that using “or” introducted. > I avoid this idiom because it fails on falsy values. > Me too. It's just too fragile. When writing code you're going to need an alternative for cases where "config.get('source_name') or default_value" doesn't work correctly; much better to use that alternative for all cases. -- "This planet has - or rather had - a problem, which was this: most of the people living on it were unhappy for pretty much of the time. Many solutions were suggested for this problem, but most of these were largely concerned with the movement of small green pieces of paper, which was odd because on the whole it wasn't the small green pieces of paper that were unhappy." -- Douglas Adams