Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Not only is UNIX dead, it's starting to smell really bad. -- Rob Pike


devel / comp.lang.python / Re: Configuring an object via a dictionary

SubjectAuthor
o Re: Configuring an object via a dictionaryPeter J. Holzer

1
Re: Configuring an object via a dictionary

<mailman.105.1710630375.3452.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=29670&group=comp.lang.python#29670

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-python@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Configuring an object via a dictionary
Date: Sun, 17 Mar 2024 00:06:06 +0100
Lines: 49
Message-ID: <mailman.105.1710630375.3452.python-list@python.org>
References: <b169e599-e81f-45ce-8e2a-7027b59a4627@tompassin.net>
<60E92E67-1412-4DE6-B330-495343107474@barrys-emacs.org>
<20240316230606.qjn5zepek645tsqq@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="fc6laldcffq2obhy"
X-Trace: news.uni-berlin.de kZ0kN4AOYjVaPvCnyb8CbQU5X37rAvlKTx8420G8DD3w==
Cancel-Lock: sha1:Ru2UFQBGMEMmoavRAKQY9iGzimo= sha256:h6ml8kCRw51YXcNCIu887d3ZyKlJPj09jSkySKwmNMM=
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'content-
type:multipart/signed': 0.05; 'mar': 0.07; 'tests': 0.07;
'content-type:application/pgp-signature': 0.09; 'fails': 0.09;
'filename:fname piece:asc': 0.09; 'filename:fname
piece:signature': 0.09; 'filename:fname:signature.asc': 0.09;
'values.': 0.09; '"creative': 0.16; '__/': 0.16; 'barry': 0.16;
'challenge!"': 0.16; 'from:addr:hjp-python': 0.16;
'from:addr:hjp.at': 0.16; 'from:name:peter j. holzer': 0.16;
'hand,': 0.16; 'hjp@hjp.at': 0.16; 'holzer': 0.16; 'idiom': 0.16;
'reality.': 0.16; 'stross,': 0.16; 'url-ip:212.17.106/24': 0.16;
'url-ip:212.17/16': 0.16; 'url:hjp': 0.16; '|_|_)': 0.16;
'wrote:': 0.16; 'problem': 0.16; 'python': 0.16; 'instead': 0.17;
'to:addr:python-list': 0.20; "i've": 0.22; "isn't": 0.27; 'bit':
0.27; 'sense': 0.28; 'gotten': 0.32; 'python-list': 0.32; 'but':
0.32; 'header:In-Reply-To:1': 0.34; 'fix': 0.36; 'using': 0.37;
'still': 0.40; 'received:212': 0.62; 'received:userid': 0.66;
'url-ip:212/8': 0.69; 'production': 0.71; 'left': 0.83;
'received:at': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <60E92E67-1412-4DE6-B330-495343107474@barrys-emacs.org>
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: <20240316230606.qjn5zepek645tsqq@hjp.at>
X-Mailman-Original-References: <b169e599-e81f-45ce-8e2a-7027b59a4627@tompassin.net>
<60E92E67-1412-4DE6-B330-495343107474@barrys-emacs.org>
 by: Peter J. Holzer - Sat, 16 Mar 2024 23:06 UTC
Attachments: signature.asc (application/pgp-signature)

On 2024-03-16 08:15:19 +0000, Barry via Python-list wrote:
> > 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.

Perl has a // operator (pronounced "err"), which works like || (or),
except that it tests whether the left side is defined (not None in
Python terms) instead of truthy. This still isn't bulletproof but I've
found it very handy.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor