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
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to