Purpose of "or False" technique in Python

In frappe/__init__.py we see three lines:

if conf.get("logging") or False:
...
no_cache = conf.developer_mode or False
..
return flags.mute_emails or cint(conf.get("mute_emails") or 0) or False

I see that if the first condition(s) is falsey, the or False will force the expression to be boolean False.
Why is this necessary?
is it possible to drop or False?
Is this a nice technique? if so, what is the purpose? Thanks

1 Like

It’s a bad practice, and I can imagine why someone did that!

Probably there’s a code somewhere that say if x is False instead of if not x these codes looks doing the same thing but I’m the first case it evaluates the identity while the second evaluates the value

So again it’s an bad practice for Python, but I don’t think is just easy to remove, some test cases will be needed to ensure that there’s no identity checking.