Mar-18-2023, 11:03 PM
if i code this:
what about coding this:
bar = 0 if foo is None: bar = 99 elif foo is True: bar = 99 print(bar)vs coding this:
bar = 0 if foo is None or foo is True: bar = 99 print(bar)will CPython3 (whatever recent version you want to consider) produce the same compilation results whether optimization is in effect or not? if not, can you guess which will be faster? how extensive is the optimization?
what about coding this:
bar = 0 if foo is None: bar = 99 if foo is True: bar = 99 print(bar)(elif changed to if), will this be any different?