On 3/16/2024 8:12 AM, Roel Schroeven via Python-list wrote:
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.

Trying to remember when I've used it, that was probably on personal code where I had a good idea what the values could be. Otherwise, I'm in agreement.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to