15 Jan
2021
15 Jan
'21
3:59 a.m.
On Fri, Jan 15, 2021 at 10:13 PM Rob Cliffe via Python-Dev
On 12/01/2021 15:53, Mark Shannon wrote:
Hi everyone,
In master we convert `if x: pass` to `pass` which is equivalent, unless bool(x) has side effects the first time it is called. This is a recent change.
Suppose x is not a currently valid variable name at runtime. Will the NameError still be "optimised" away?
No, it won't. The expression still gets fully evaluated. The ONLY part that gets optimized away is the check "is this thing true?". ChrisA