Python efficiency of and vs multiple ifs

后端 未结 5 865
太阳男子
太阳男子 2021-02-07 05:32

Is there an efficiency difference between using and in an if statement and using multiple if statements? In other words, is something like

if expr1 == expr2 and         


        
5条回答
  •  执笔经年
    2021-02-07 06:15

    In either case, expr1 == expr2 evaluates to false in if, the second will not be evaluated.

提交回复
热议问题